💬 feat: assistant conversation starter (#3699)

* feat: initial UI convoStart

* fix: ConvoStarter UI

* fix: convoStarters bug

* feat: Add input field focus on conversation starters

* style: conversation starter UI update

* feat: apply fixes for starters

* style: update conversationStarters UI and fixed typo

* general UI update

* feat: Add onClick functionality to ConvoStarter component

* fix: quick fix test

* fix(AssistantSelect): remove object check

* fix: updateAssistant `conversation_starters` var

* chore: remove starter autofocus

* fix: no empty conversation starters, always show input, use Constants value for max count

* style: Update defaultTextPropsLabel styles, for a11y placeholder

* refactor: Update ConvoStarter component styles and class names for a11y and theme

* refactor: convostarter, move plus button to within persistent element

* fix: types

* chore: Update landing page assistant description styling with theming

* chore: assistant types

* refactor: documents routes

* refactor: optimize conversation starter mutations/queries

* refactor: Update listAllAssistants return type to Promise<Array<Assistant>>

* feat: edit existing starters

* feat(convo-starters): enhance ConvoStarter component and add animations

    - Update ConvoStarter component styling for better visual appeal
    - Implement fade-in animation for smoother appearance
    - Add hover effect with background color change
    - Improve text overflow handling with line-clamp and text-balance
    - Ensure responsive design for various screen sizes

* feat(assistant): add conversation starters to assistant builder

- Add localization strings for conversation starters
- Update mobile.css with shake animation for max starters reached
- Enhance user experience with tooltips and dynamic input handling

* refactor: select specific fields for assistant documents fetch

* refactor: remove endpoint query key, fetch all assistant docs for now, add conversation_starters to v1 methods

* refactor: add document filters based on endpoint config

* fix: starters not applied during creation

* refactor: update AssistantSelect component to handle undefined lastSelectedModels

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Marco Beretta 2024-08-31 13:42:20 -04:00 committed by GitHub
parent 63b80c3067
commit 79f9cd5a4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 602 additions and 214 deletions

View file

@ -972,6 +972,8 @@ export enum Constants {
DEFAULT_STREAM_RATE = 1,
/** Saved Tag */
SAVED_TAG = 'Saved',
/** Max number of Conversation starters for Agents/Assistants */
MAX_CONVO_STARTERS = 4,
}
export enum LocalStorageKeys {

View file

@ -255,14 +255,18 @@ export function getAssistantDocs({
endpoint,
version,
}: {
endpoint: s.AssistantsEndpoint;
endpoint: s.AssistantsEndpoint | string;
version: number | string;
}): Promise<a.AssistantDocument[]> {
if (!s.isAssistantsEndpoint(endpoint)) {
return Promise.resolve([]);
}
return request.get(
endpoints.assistants({
path: 'documents',
version,
endpoint,
options: { endpoint },
endpoint: endpoint as s.AssistantsEndpoint,
}),
);
}

View file

@ -61,6 +61,7 @@ export const defaultAssistantFormValues = {
name: '',
description: '',
instructions: '',
conversation_starters: [],
model: '',
functions: [],
code_interpreter: false,

View file

@ -70,13 +70,14 @@ export type Assistant = {
id: string;
created_at: number;
description: string | null;
file_ids: string[];
file_ids?: string[];
instructions: string | null;
conversation_starters?: string[];
metadata: Metadata | null;
model: string;
name: string | null;
object: string;
tools: FunctionTool[];
tools?: FunctionTool[];
tool_resources?: ToolResources;
};
@ -87,6 +88,7 @@ export type AssistantCreateParams = {
description?: string | null;
file_ids?: string[];
instructions?: string | null;
conversation_starters?: string[];
metadata?: Metadata | null;
name?: string | null;
tools?: Array<FunctionTool | string>;
@ -99,6 +101,7 @@ export type AssistantUpdateParams = {
description?: string | null;
file_ids?: string[];
instructions?: string | null;
conversation_starters?: string[] | null;
metadata?: Metadata | null;
name?: string | null;
tools?: Array<FunctionTool | string>;
@ -392,6 +395,7 @@ export type AssistantAvatar = {
export type AssistantDocument = {
user: string;
assistant_id: string;
conversation_starters?: string[];
avatar?: AssistantAvatar;
access_level?: number;
file_ids?: string[];