move chatstore to @types/chatsotre.ts

This commit is contained in:
2024-10-15 09:44:40 +08:00
parent f0f040c42c
commit 04bac03fd7
2 changed files with 74 additions and 63 deletions

57
src/types/chatstore.ts Normal file
View File

@@ -0,0 +1,57 @@
import { Logprobs, Message } from "@/chatgpt";
/**
* ChatStore is the main object of the chatgpt-api-web,
* stored in IndexedDB and passed across various components.
* It contains all the information needed for a conversation.
*/
export interface ChatStore {
chatgpt_api_web_version: string;
systemMessageContent: string;
toolsString: string;
history: ChatStoreMessage[];
postBeginIndex: number;
tokenMargin: number;
totalTokens: number;
maxTokens: number;
maxGenTokens: number;
maxGenTokens_enabled: boolean;
apiKey: string;
apiEndpoint: string;
streamMode: boolean;
model: string;
responseModelName: string;
cost: number;
temperature: number;
temperature_enabled: boolean;
top_p: number;
top_p_enabled: boolean;
presence_penalty: number;
frequency_penalty: number;
develop_mode: boolean;
whisper_api: string;
whisper_key: string;
tts_api: string;
tts_key: string;
tts_voice: string;
tts_speed: number;
tts_speed_enabled: boolean;
tts_format: string;
image_gen_api: string;
image_gen_key: string;
json_mode: boolean;
logprobs: boolean;
contents_for_index: string[];
}
/**
* ChatStoreMessage extends the Message type defined by OpenAI.
* It adds more fields to be stored within the ChatStore structure.
*/
export interface ChatStoreMessage extends Message {
hide: boolean;
token: number;
example: boolean;
audio: Blob | null;
logprobs: Logprobs | null;
}