feat: support assistant frontend (#2139)

Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
Joel
2024-01-23 19:31:56 +08:00
committed by GitHub
parent e65a2a400d
commit 7bbe12b2bd
194 changed files with 8726 additions and 1586 deletions

View File

@@ -1,5 +1,5 @@
import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug.ts'
import type { ExternalDataTool } from '@/models/common'
import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug'
import type { CollectionType } from '@/app/components/tools/types'
export enum ProviderType {
openai = 'openai',
anthropic = 'anthropic',
@@ -90,6 +90,18 @@ export type UserInputFormItem = {
'select': SelectTypeFormItem
}
export type AgentTool = {
provider_id: string
provider_type: CollectionType
provider_name: string
tool_name: string
tool_label: string
tool_parameters: Record<string, any>
enabled: boolean
isDeleted?: boolean
notAuthor?: boolean
}
export type ToolItem = {
dataset: {
enabled: boolean
@@ -101,6 +113,11 @@ export type ToolItem = {
words: string[]
canned_response: string
}
} | AgentTool
export enum AgentStrategy {
functionCall = 'function_call',
react = 'react',
}
/**
@@ -108,6 +125,7 @@ export type ToolItem = {
*/
export type ModelConfig = {
opening_statement: string
suggested_questions?: string[]
pre_prompt: string
prompt_type: PromptMode
chat_prompt_config: ChatPromptConfig | {}
@@ -129,10 +147,10 @@ export type ModelConfig = {
sensitive_word_avoidance: {
enabled: boolean
}
external_data_tools: ExternalDataTool[]
annotation_reply?: AnnotationReplyConfig
agent_mode: {
enabled: boolean
strategy?: AgentStrategy
tools: ToolItem[]
}
model: {
@@ -252,6 +270,7 @@ export type App = {
/** Mode */
mode: AppMode
is_agent: boolean
/** Enable web app */
enable_site: boolean
/** Enable web API */
@@ -325,6 +344,7 @@ export type VisionFile = {
transfer_method: TransferMethod
url: string
upload_file_id: string
belongs_to?: string
}
export type RetrievalConfig = {