123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- import type { ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug.ts'
- export enum ProviderType {
- openai = 'openai',
- anthropic = 'anthropic',
- azure_openai = 'azure_openai',
- replicate = 'replicate',
- huggingface_hub = 'huggingface_hub',
- minimax = 'minimax',
- tongyi = 'tongyi',
- spark = 'spark',
- }
- export enum AppType {
- 'chat' = 'chat',
- 'completion' = 'completion',
- }
- export enum ModelModeType {
- 'chat' = 'chat',
- 'completion' = 'completion',
- 'unset' = '',
- }
- export type VariableInput = {
- key: string
- name: string
- value: string
- }
- export const AppModes = ['completion', 'chat'] as const
- export type AppMode = typeof AppModes[number]
- export const VariableTypes = ['string', 'number', 'select'] as const
- export type VariableType = typeof VariableTypes[number]
- export type PromptVariable = {
-
- key: string
-
- name: string
-
- type: VariableType
- required: boolean
-
- options?: string[]
- max_length?: number
- }
- export type TextTypeFormItem = {
- label: string
- variable: string
- required: boolean
- max_length: number
- }
- export type SelectTypeFormItem = {
- label: string
- variable: string
- required: boolean
- options: string[]
- }
- export type UserInputFormItem = {
- 'text-input': TextTypeFormItem
- } | {
- 'select': SelectTypeFormItem
- }
- export type ToolItem = {
- dataset: {
- enabled: boolean
- id: string
- }
- } | {
- 'sensitive-word-avoidance': {
- enabled: boolean
- words: string[]
- canned_response: string
- }
- }
- export type ModelConfig = {
- opening_statement: string
- pre_prompt: string
- prompt_type: PromptMode
- chat_prompt_config: ChatPromptConfig | {}
- completion_prompt_config: CompletionPromptConfig | {}
- user_input_form: UserInputFormItem[]
- dataset_query_variable?: string
- more_like_this: {
- enabled: boolean
- }
- suggested_questions_after_answer: {
- enabled: boolean
- }
- speech_to_text: {
- enabled: boolean
- }
- retriever_resource: {
- enabled: boolean
- }
- agent_mode: {
- enabled: boolean
- tools: ToolItem[]
- }
- model: {
-
- provider: string
-
- name: string
- mode: ModelModeType
-
- completion_params: {
-
- max_tokens: number
-
- temperature: number
-
- top_p: number
-
- echo: boolean
-
- stop: string[]
-
- presence_penalty: number
-
- frequency_penalty: number
- }
- }
- dataset_configs: DatasetConfigs
- }
- export const LanguagesSupported = ['zh-Hans', 'en-US'] as const
- export type Language = typeof LanguagesSupported[number]
- export type SiteConfig = {
-
- access_token: string
-
- title: string
-
- description: string
-
- author: string
-
- support_email: string
-
- default_language: Language
-
- customize_domain: string
-
- theme: string
-
- customize_token_strategy: 'must' | 'allow' | 'not_allow'
-
- prompt_public: boolean
-
- app_base_url: string
-
- copyright: string
-
- privacy_policy: string
- icon: string
- icon_background: string
- }
- export type App = {
-
- id: string
-
- name: string
-
- icon: string
-
- icon_background: string
-
- mode: AppMode
-
- enable_site: boolean
-
- enable_api: boolean
-
- api_rpm: number
-
- api_rph: number
-
- is_demo: boolean
-
- model_config: ModelConfig
- app_model_config: ModelConfig
-
- created_at: number
-
- site: SiteConfig
-
- api_base_url: string
- }
- export type AppTemplate = {
-
- name: string
-
- description: string
-
- mode: AppMode
-
- model_config: ModelConfig
- }
|