🚀 feat: Assistants Streaming (#2159)

* chore: bump openai to 4.29.0 and npm audit fix

* chore: remove unnecessary stream field from ContentData

* feat: new enum and types for AssistantStreamEvent

* refactor(AssistantService): remove stream field and add conversationId to text ContentData
> - return `finalMessage` and `text` on run completion
> - move `processMessages` to services/Threads to avoid circular dependencies with new stream handling
> - refactor(processMessages/retrieveAndProcessFile): add new `client` field to differentiate new RunClient type

* WIP: new assistants stream handling

* chore: stores messages to StreamRunManager

* chore: add additional typedefs

* fix: pass req and openai to StreamRunManager

* fix(AssistantService): pass openai as client to `retrieveAndProcessFile`

* WIP: streaming tool i/o, handle in_progress and completed run steps

* feat(assistants): process required actions with streaming enabled

* chore: condense early return check for useSSE useEffect

* chore: remove unnecessary comments and only handle completed tool calls when not function

* feat: add TTL for assistants run abort cacheKey

* feat: abort stream runs

* fix(assistants): render streaming cursor

* fix(assistants): hide edit icon as functionality is not supported

* fix(textArea): handle pasting edge cases; first, when onChange events wouldn't fire; second, when textarea wouldn't resize

* chore: memoize Conversations

* chore(useTextarea): reverse args order

* fix: load default capabilities when an azure is configured to support assistants, but `assistants` endpoint is not configured

* fix(AssistantSelect): update form assistant model on assistant form select

* fix(actions): handle azure strict validation for function names to fix crud for actions

* chore: remove content data debug log as it fires in rapid succession

* feat: improve UX for assistant errors mid-request

* feat: add tool call localizations and replace any domain separators from azure action names

* refactor(chat): error out tool calls without outputs during handleError

* fix(ToolService): handle domain separators allowing Azure use of actions

* refactor(StreamRunManager): types and throw Error if tool submission fails
This commit is contained in:
Danny Avila 2024-03-21 22:42:25 -04:00 committed by GitHub
parent ed64c76053
commit f427ad792a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 1503 additions and 330 deletions

View file

@ -24,6 +24,17 @@ export default {
com_assistants_actions: 'Actions',
com_assistants_add_tools: 'Add Tools',
com_assistants_add_actions: 'Add Actions',
com_assistants_available_actions: 'Available Actions',
com_assistants_running_action: 'Running action',
com_assistants_completed_action: 'Talked to {0}',
com_assistants_completed_function: 'Ran {0}',
com_assistants_function_use: 'Assistant used {0}',
com_assistants_domain_info: 'Assistant sent this info to {0}',
com_assistants_delete_actions_success: 'Successfully deleted Action from Assistant',
com_assistants_update_actions_success: 'Successfully created or updated Action',
com_assistants_update_actions_error: 'There was an error creating or updating the action.',
com_assistants_delete_actions_error: 'There was an error deleting the action.',
com_assistants_actions_info: 'Let your Assistant retrieve information or take actions via API\'s',
com_assistants_name_placeholder: 'Optional: The name of the assistant',
com_assistants_instructions_placeholder: 'The system instructions that the assistant uses',
com_assistants_description_placeholder: 'Optional: Describe your Assistant here',
@ -61,6 +72,8 @@ export default {
com_ui_context: 'Context',
com_ui_size: 'Size',
com_ui_host: 'Host',
com_ui_update: 'Update',
com_ui_authentication: 'Authentication',
com_ui_instructions: 'Instructions',
com_ui_description: 'Description',
com_ui_error: 'Error',
@ -106,6 +119,7 @@ export default {
com_ui_chats: 'chats',
com_ui_avatar: 'Avatar',
com_ui_unknown: 'Unknown',
com_ui_result: 'Result',
com_ui_image_gen: 'Image Gen',
com_ui_assistant: 'Assistant',
com_ui_assistants: 'Assistants',