feat: add api-based extension & external data tool & moderation (#1459)
This commit is contained in:
parent
db43ed6f41
commit
32747641e4
84 changed files with 3327 additions and 167 deletions
|
|
@ -92,7 +92,7 @@ export type Provider = {
|
|||
is_valid: boolean
|
||||
is_enabled: boolean
|
||||
last_used: string
|
||||
token?: ProviderTokenType[Name]
|
||||
token?: string | ProviderAzureToken | ProviderAnthropicToken
|
||||
}
|
||||
}[ProviderName]
|
||||
|
||||
|
|
@ -196,3 +196,60 @@ export type InvitationResult = {
|
|||
export type InvitationResponse = CommonResponse & {
|
||||
invitation_results: InvitationResult[]
|
||||
}
|
||||
|
||||
export type ApiBasedExtension = {
|
||||
id?: string
|
||||
name?: string
|
||||
api_endpoint?: string
|
||||
api_key?: string
|
||||
}
|
||||
|
||||
export type I18nText = {
|
||||
'en-US': string
|
||||
'zh-Hans': string
|
||||
}
|
||||
|
||||
export type CodeBasedExtensionForm = {
|
||||
type: string
|
||||
label: I18nText
|
||||
variable: string
|
||||
required: boolean
|
||||
options: string[]
|
||||
default: string
|
||||
placeholder: string
|
||||
}
|
||||
|
||||
export type CodeBasedExtensionItem = {
|
||||
name: string
|
||||
label: I18nText
|
||||
form_schema: CodeBasedExtensionForm[]
|
||||
}
|
||||
export type CodeBasedExtension = {
|
||||
module: string
|
||||
data: CodeBasedExtensionItem[]
|
||||
}
|
||||
|
||||
export type ExternalDataTool = {
|
||||
type?: string
|
||||
label?: string
|
||||
icon?: string
|
||||
icon_background?: string
|
||||
variable?: string
|
||||
enabled?: boolean
|
||||
config?: {
|
||||
api_based_extension_id?: string
|
||||
} & Partial<Record<string, any>>
|
||||
}
|
||||
|
||||
export type ModerateResponse = {
|
||||
flagged: boolean
|
||||
text: string
|
||||
}
|
||||
|
||||
export type ModerationService = (
|
||||
url: string,
|
||||
body: {
|
||||
app_id: string
|
||||
text: string
|
||||
}
|
||||
) => Promise<ModerateResponse>
|
||||
|
|
|
|||
|
|
@ -73,6 +73,20 @@ export type SpeechToTextConfig = MoreLikeThisConfig
|
|||
|
||||
export type CitationConfig = MoreLikeThisConfig
|
||||
|
||||
export type ModerationContentConfig = {
|
||||
enabled: boolean
|
||||
preset_response?: string
|
||||
}
|
||||
export type ModerationConfig = MoreLikeThisConfig & {
|
||||
type?: string
|
||||
config?: {
|
||||
keywords?: string
|
||||
api_based_extension_id?: string
|
||||
inputs_config?: ModerationContentConfig
|
||||
outputs_config?: ModerationContentConfig
|
||||
} & Partial<Record<string, any>>
|
||||
}
|
||||
|
||||
export type RetrieverResourceConfig = MoreLikeThisConfig
|
||||
|
||||
// frontend use. Not the same as backend
|
||||
|
|
@ -86,6 +100,7 @@ export type ModelConfig = {
|
|||
suggested_questions_after_answer: SuggestedQuestionsAfterAnswerConfig | null
|
||||
speech_to_text: SpeechToTextConfig | null
|
||||
retriever_resource: RetrieverResourceConfig | null
|
||||
sensitive_word_avoidance: ModerationConfig | null
|
||||
dataSets: any[]
|
||||
}
|
||||
export type DatasetConfigItem = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue