refactor: reorganize type definitions and improve type safety build: add lodash and @types/lodash as dependencies chore: update tsconfig and vite config for path aliases style: improve code organization and add documentation comments fix: correct type usage in LanguageSwitcher component perf: implement snackbar provider for global notifications test: add new test interfaces and utility functions ci: update pnpm-lock.yaml with new dependencies
108 lines
2.8 KiB
TypeScript
108 lines
2.8 KiB
TypeScript
// object freeze
|
|
export const KNOWLEDGE_ROUTE_KEYS = Object.freeze({
|
|
Dataset: 'dataset',
|
|
Testing: 'testing',
|
|
Configuration: 'configuration',
|
|
KnowledgeGraph: 'knowledgeGraph',
|
|
} as const)
|
|
|
|
export type KnowledgeRouteKey = (typeof KNOWLEDGE_ROUTE_KEYS)[keyof typeof KNOWLEDGE_ROUTE_KEYS]
|
|
|
|
export const RUNNING_STATUS_KEYS = Object.freeze({
|
|
UNSTART: '0', // need to run
|
|
RUNNING: '1', // need to cancel
|
|
CANCEL: '2', // need to refresh
|
|
DONE: '3', // need to refresh
|
|
FAIL: '4', // need to refresh
|
|
} as const)
|
|
|
|
export type RunningStatus = (typeof RUNNING_STATUS_KEYS)[keyof typeof RUNNING_STATUS_KEYS]
|
|
|
|
export const RunningStatusMap = {
|
|
[RUNNING_STATUS_KEYS.UNSTART]: 'Pending',
|
|
[RUNNING_STATUS_KEYS.RUNNING]: 'Running',
|
|
[RUNNING_STATUS_KEYS.CANCEL]: 'Cancel',
|
|
[RUNNING_STATUS_KEYS.DONE]: 'Success',
|
|
[RUNNING_STATUS_KEYS.FAIL]: 'Failed',
|
|
} as const;
|
|
export const MODEL_VARIABLE_TYPES = Object.freeze({
|
|
Improvise: 'Improvise',
|
|
Precise: 'Precise',
|
|
Balance: 'Balance',
|
|
} as const)
|
|
|
|
export type ModelVariableType = (typeof MODEL_VARIABLE_TYPES)[keyof typeof MODEL_VARIABLE_TYPES]
|
|
|
|
|
|
export const settledModelVariableMap = {
|
|
[MODEL_VARIABLE_TYPES.Improvise]: {
|
|
temperature: 0.8,
|
|
top_p: 0.9,
|
|
frequency_penalty: 0.1,
|
|
presence_penalty: 0.1,
|
|
max_tokens: 4096,
|
|
},
|
|
[MODEL_VARIABLE_TYPES.Precise]: {
|
|
temperature: 0.2,
|
|
top_p: 0.75,
|
|
frequency_penalty: 0.5,
|
|
presence_penalty: 0.5,
|
|
max_tokens: 4096,
|
|
},
|
|
[MODEL_VARIABLE_TYPES.Balance]: {
|
|
temperature: 0.5,
|
|
top_p: 0.85,
|
|
frequency_penalty: 0.3,
|
|
presence_penalty: 0.2,
|
|
max_tokens: 4096,
|
|
},
|
|
} as const;
|
|
|
|
export const LLM_MODEL_TYPES = Object.freeze({
|
|
Embedding: 'embedding',
|
|
Chat: 'chat',
|
|
Image2text: 'image2text',
|
|
Speech2text: 'speech2text',
|
|
Rerank: 'rerank',
|
|
TTS: 'tts',
|
|
} as const)
|
|
|
|
export type LlmModelType = (typeof LLM_MODEL_TYPES)[keyof typeof LLM_MODEL_TYPES]
|
|
|
|
export const DOCUMENT_TYPES = Object.freeze({
|
|
Virtual: 'virtual',
|
|
Visual: 'visual',
|
|
} as const)
|
|
|
|
export type DocumentType = (typeof DOCUMENT_TYPES)[keyof typeof DOCUMENT_TYPES]
|
|
|
|
export const DOCUMENT_PARSER_TYPES = Object.freeze({
|
|
Naive: 'naive',
|
|
Qa: 'qa',
|
|
Resume: 'resume',
|
|
Manual: 'manual',
|
|
Table: 'table',
|
|
Paper: 'paper',
|
|
Book: 'book',
|
|
Laws: 'laws',
|
|
Presentation: 'presentation',
|
|
Picture: 'picture',
|
|
One: 'one',
|
|
Audio: 'audio',
|
|
Email: 'email',
|
|
Tag: 'tag',
|
|
KnowledgeGraph: 'knowledge_graph',
|
|
} as const)
|
|
|
|
export type DocumentParserType = (typeof DOCUMENT_PARSER_TYPES)[keyof typeof DOCUMENT_PARSER_TYPES]
|
|
|
|
export const KNOWLEDGE_SEARCH_PARAMS_KEYS = Object.freeze({
|
|
DocumentId: 'doc_id',
|
|
KnowledgeId: 'id',
|
|
Type: 'type',
|
|
} as const)
|
|
|
|
export type KnowledgeSearchParams = (typeof KNOWLEDGE_SEARCH_PARAMS_KEYS)[keyof typeof KNOWLEDGE_SEARCH_PARAMS_KEYS]
|
|
|
|
export const DATABASE_BASE_KEY = 'dataset';
|