Migrate new service (#1)
This commit is contained in:
1 parent
f13ca37d63
commit
28da0263dc
109 files changed
+1160
-1053
No files matched your search
@@ -0,0 +1,89 @@
|
||||
import { ROLE_ASSISTANT, ROLE_SYSTEM, ROLE_USER } from '@/constants';
|
||||
import {
|
||||
CHAT_MODEL_NAME_GPT_3_5,
|
||||
CHAT_MODEL_NAME_GPT_3_5_BROWSING,
|
||||
CHAT_MODEL_NAME_GPT_4,
|
||||
CHAT_MODEL_NAME_GPT_4_BROWSING,
|
||||
CHAT_MODEL_NAME_GPT_4_VISION
|
||||
} from '@/constants';
|
||||
|
||||
export type IChatModelName =
|
||||
| typeof CHAT_MODEL_NAME_GPT_3_5
|
||||
| typeof CHAT_MODEL_NAME_GPT_3_5_BROWSING
|
||||
| typeof CHAT_MODEL_NAME_GPT_4
|
||||
| typeof CHAT_MODEL_NAME_GPT_4_BROWSING
|
||||
| typeof CHAT_MODEL_NAME_GPT_4_VISION;
|
||||
|
||||
export interface IChatModel {
|
||||
name: IChatModelName;
|
||||
displayName: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface IError {
|
||||
code: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export enum IChatMessageState {
|
||||
PENDING = 'pending',
|
||||
ANSWERING = 'answering',
|
||||
FINISHED = 'finished',
|
||||
FAILED = 'failed'
|
||||
}
|
||||
|
||||
export interface IChatMessageContentItem {
|
||||
type: string;
|
||||
text?: string;
|
||||
image_url?: string;
|
||||
}
|
||||
|
||||
export interface IChatMessage {
|
||||
state?: IChatMessageState;
|
||||
content?: string | IChatMessageContentItem[];
|
||||
role?: typeof ROLE_SYSTEM | typeof ROLE_ASSISTANT | typeof ROLE_USER;
|
||||
error?: IError;
|
||||
}
|
||||
|
||||
export interface IChatConversation {
|
||||
id: string;
|
||||
messages: IChatMessage[];
|
||||
title?: string;
|
||||
deleting?: boolean;
|
||||
editing?: boolean;
|
||||
new?: boolean;
|
||||
}
|
||||
|
||||
export interface IChatConversationOptions {
|
||||
stream?: (response: IChatConversationResponse) => void;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface IChatConversationRequest {
|
||||
id?: string;
|
||||
question?: string;
|
||||
references?: string[];
|
||||
stateful?: boolean;
|
||||
messages?: IChatMessage[];
|
||||
action?: IChatConversationAction;
|
||||
model: IChatModelName;
|
||||
}
|
||||
|
||||
export interface IChatConversationResponse {
|
||||
answer: string;
|
||||
delta_answer: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface IChatConversationsResponse {
|
||||
items: IChatConversation[];
|
||||
count: number;
|
||||
}
|
||||
|
||||
export enum IChatConversationAction {
|
||||
CHAT = 'chat',
|
||||
RETRIEVE = 'retrieve',
|
||||
UPDATE = 'update',
|
||||
DELETE = 'delete',
|
||||
RETRIEVE_BATCH = 'retrieve_batch'
|
||||
}
|
||||
Reference in new issue
Block a user