2024-02-22 17:14:25 +08:00
|
|
|
import { MessageType } from '@/constants/chat';
|
2024-03-05 16:30:28 +08:00
|
|
|
import { IChunk } from './knowledge';
|
2024-02-22 17:14:25 +08:00
|
|
|
|
2024-02-20 18:10:20 +08:00
|
|
|
export interface PromptConfig {
|
|
|
|
|
empty_response: string;
|
|
|
|
|
parameters: Parameter[];
|
|
|
|
|
prologue: string;
|
|
|
|
|
system: string;
|
2024-09-14 17:19:04 +08:00
|
|
|
tts?: boolean;
|
2024-02-20 18:10:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Parameter {
|
|
|
|
|
key: string;
|
|
|
|
|
optional: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface LlmSetting {
|
|
|
|
|
Creative: Variable;
|
|
|
|
|
Custom: Variable;
|
|
|
|
|
Evenly: Variable;
|
|
|
|
|
Precise: Variable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Variable {
|
2024-04-30 11:27:10 +08:00
|
|
|
frequency_penalty?: number;
|
|
|
|
|
max_tokens?: number;
|
|
|
|
|
presence_penalty?: number;
|
|
|
|
|
temperature?: number;
|
|
|
|
|
top_p?: number;
|
2024-02-20 18:10:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IDialog {
|
|
|
|
|
create_date: string;
|
|
|
|
|
create_time: number;
|
|
|
|
|
description: string;
|
|
|
|
|
icon: string;
|
|
|
|
|
id: string;
|
2024-08-27 15:24:28 +08:00
|
|
|
dialog_id?: string;
|
2024-02-20 18:10:20 +08:00
|
|
|
kb_ids: string[];
|
|
|
|
|
kb_names: string[];
|
|
|
|
|
language: string;
|
|
|
|
|
llm_id: string;
|
2024-04-30 11:27:10 +08:00
|
|
|
llm_setting: Variable;
|
2024-02-20 18:10:20 +08:00
|
|
|
llm_setting_type: string;
|
|
|
|
|
name: string;
|
|
|
|
|
prompt_config: PromptConfig;
|
|
|
|
|
prompt_type: string;
|
|
|
|
|
status: string;
|
|
|
|
|
tenant_id: string;
|
|
|
|
|
update_date: string;
|
|
|
|
|
update_time: number;
|
2024-05-29 16:19:08 +08:00
|
|
|
vector_similarity_weight: number;
|
|
|
|
|
similarity_threshold: number;
|
2024-02-20 18:10:20 +08:00
|
|
|
}
|
2024-02-22 17:14:25 +08:00
|
|
|
|
|
|
|
|
export interface IConversation {
|
|
|
|
|
create_date: string;
|
|
|
|
|
create_time: number;
|
|
|
|
|
dialog_id: string;
|
|
|
|
|
id: string;
|
|
|
|
|
message: Message[];
|
2024-02-26 18:38:54 +08:00
|
|
|
reference: IReference[];
|
2024-02-22 17:14:25 +08:00
|
|
|
name: string;
|
|
|
|
|
update_date: string;
|
|
|
|
|
update_time: number;
|
2024-09-27 18:20:19 +08:00
|
|
|
is_new: true;
|
2024-02-22 17:14:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Message {
|
|
|
|
|
content: string;
|
|
|
|
|
role: MessageType;
|
2024-08-14 17:26:47 +08:00
|
|
|
doc_ids?: string[];
|
2024-08-28 19:05:15 +08:00
|
|
|
prompt?: string;
|
|
|
|
|
id?: string;
|
2024-09-03 19:47:50 +08:00
|
|
|
audio_binary?: string;
|
2024-02-22 17:14:25 +08:00
|
|
|
}
|
2024-02-26 18:38:54 +08:00
|
|
|
|
|
|
|
|
export interface IReference {
|
2024-03-05 16:30:28 +08:00
|
|
|
chunks: IChunk[];
|
2024-02-26 18:38:54 +08:00
|
|
|
doc_aggs: Docagg[];
|
|
|
|
|
total: number;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 20:15:02 +08:00
|
|
|
export interface IAnswer {
|
|
|
|
|
answer: string;
|
|
|
|
|
reference: IReference;
|
2024-07-17 14:49:11 +08:00
|
|
|
conversationId?: string;
|
2024-08-28 19:05:15 +08:00
|
|
|
prompt?: string;
|
|
|
|
|
id?: string;
|
2024-09-03 19:47:50 +08:00
|
|
|
audio_binary?: string;
|
2024-05-16 20:15:02 +08:00
|
|
|
}
|
|
|
|
|
|
2024-02-27 19:05:50 +08:00
|
|
|
export interface Docagg {
|
2024-02-26 18:38:54 +08:00
|
|
|
count: number;
|
|
|
|
|
doc_id: string;
|
|
|
|
|
doc_name: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-05 16:30:28 +08:00
|
|
|
// interface Chunk {
|
|
|
|
|
// chunk_id: string;
|
|
|
|
|
// content_ltks: string;
|
|
|
|
|
// content_with_weight: string;
|
|
|
|
|
// doc_id: string;
|
|
|
|
|
// docnm_kwd: string;
|
|
|
|
|
// img_id: string;
|
|
|
|
|
// important_kwd: any[];
|
|
|
|
|
// kb_id: string;
|
|
|
|
|
// similarity: number;
|
|
|
|
|
// term_similarity: number;
|
|
|
|
|
// vector_similarity: number;
|
|
|
|
|
// }
|
2024-04-16 19:06:47 +08:00
|
|
|
|
|
|
|
|
export interface IToken {
|
|
|
|
|
create_date: string;
|
|
|
|
|
create_time: number;
|
|
|
|
|
tenant_id: string;
|
|
|
|
|
token: string;
|
|
|
|
|
update_date?: any;
|
|
|
|
|
update_time?: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IStats {
|
|
|
|
|
pv: [string, number][];
|
|
|
|
|
uv: [string, number][];
|
|
|
|
|
speed: [string, number][];
|
|
|
|
|
tokens: [string, number][];
|
|
|
|
|
round: [string, number][];
|
|
|
|
|
thumb_up: [string, number][];
|
|
|
|
|
}
|