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
commit 7bbe12b2bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
194 changed files with 8726 additions and 1586 deletions

View file

@ -1,4 +1,4 @@
import type { ModelModeType, RETRIEVE_TYPE } from '@/types/app'
import type { AgentStrategy, ModelModeType, RETRIEVE_TYPE, ToolItem } from '@/types/app'
export type Inputs = Record<string, string | number | object>
export enum PromptMode {
@ -41,10 +41,14 @@ export type PromptVariable = {
name: string
type: string // "string" | "number" | "select",
default?: string | number
required: boolean
required?: boolean
options?: string[]
max_length?: number
is_context_var?: boolean
enabled?: boolean
config?: Record<string, any>
icon?: string
icon_background?: string
}
export type CompletionParams = {
@ -98,7 +102,12 @@ export type ModerationConfig = MoreLikeThisConfig & {
}
export type RetrieverResourceConfig = MoreLikeThisConfig
export type AgentConfig = {
enabled: boolean
strategy: AgentStrategy
max_iteration: number
tools: ToolItem[]
}
// frontend use. Not the same as backend
export type ModelConfig = {
provider: string // LLM Provider: for example "OPENAI"
@ -112,6 +121,7 @@ export type ModelConfig = {
retriever_resource: RetrieverResourceConfig | null
sensitive_word_avoidance: ModerationConfig | null
dataSets: any[]
agentConfig: AgentConfig
}
export type DatasetConfigItem = {
enable: boolean
@ -127,6 +137,12 @@ export type DatasetConfigs = {
top_k: number
score_threshold_enabled: boolean
score_threshold: number
datasets: {
datasets: {
enabled: boolean
id: string
}[]
}
}
export type DebugRequestBody = {

View file

@ -6,6 +6,7 @@ export type AppBasicInfo = {
mode: AppMode
icon: string
icon_background: string
is_agent: boolean
}
export type AppCategory = 'Writing' | 'Translate' | 'HR' | 'Programming' | 'Assistant'
@ -22,6 +23,7 @@ export type App = {
install_count: number
installed: boolean
editable: boolean
is_agent: boolean
}
export type InstalledApp = {

View file

@ -19,3 +19,7 @@ export type SiteInfo = {
copyright?: string
privacy_policy?: string
}
export type AppMeta = {
tool_icons: Record<string, string>
}