diff --git a/src/app.tsx b/src/app.tsx index b515c3d..51fc850 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -9,17 +9,13 @@ import { DefaultModel } from "@/const"; import { Tr, langCodeContext, LANG_OPTIONS } from "@/translate"; import { ChatStore } from "@/types/chatstore"; import { newChatStore } from "@/types/newChatstore"; +import { + STORAGE_NAME, + STORAGE_NAME_INDEXES, + STORAGE_NAME_TOTALCOST, + STORAGE_NAME_SELECTED +} from '@/const'; -export const STORAGE_NAME = "chatgpt-api-web"; -const STORAGE_NAME_SELECTED = `${STORAGE_NAME}-selected`; -const STORAGE_NAME_INDEXES = `${STORAGE_NAME}-indexes`; -const STORAGE_NAME_TOTALCOST = `${STORAGE_NAME}-totalcost`; -export const STORAGE_NAME_TEMPLATE = `${STORAGE_NAME}-template`; -export const STORAGE_NAME_TEMPLATE_API = `${STORAGE_NAME_TEMPLATE}-api`; -export const STORAGE_NAME_TEMPLATE_API_WHISPER = `${STORAGE_NAME_TEMPLATE}-api-whisper`; -export const STORAGE_NAME_TEMPLATE_API_TTS = `${STORAGE_NAME_TEMPLATE}-api-tts`; -export const STORAGE_NAME_TEMPLATE_API_IMAGE_GEN = `${STORAGE_NAME_TEMPLATE}-api-image-gen`; -export const STORAGE_NAME_TEMPLATE_TOOLS = `${STORAGE_NAME_TEMPLATE}-tools`; export function addTotalCost(cost: number) { let totalCost = getTotalCost(); diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 8eb07e3..6dd7afe 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -21,6 +21,8 @@ import { STORAGE_NAME_TEMPLATE_API_TTS, STORAGE_NAME_TEMPLATE_API_WHISPER, STORAGE_NAME_TEMPLATE_TOOLS, +} from "@/const"; +import { addTotalCost, getTotalCost, } from "@/app"; diff --git a/src/const.ts b/src/const.ts index 14c7bd7..8692abd 100644 --- a/src/const.ts +++ b/src/const.ts @@ -1,3 +1,14 @@ export const DefaultAPIEndpoint = "https://api.openai.com/v1/chat/completions"; export const CHATGPT_API_WEB_VERSION = "v2.1.0"; export const DefaultModel = "gpt-4o-mini"; + +export const STORAGE_NAME = "chatgpt-api-web"; +export const STORAGE_NAME_SELECTED = `${STORAGE_NAME}-selected`; +export const STORAGE_NAME_INDEXES = `${STORAGE_NAME}-indexes`; +export const STORAGE_NAME_TOTALCOST = `${STORAGE_NAME}-totalcost`; +export const STORAGE_NAME_TEMPLATE = `${STORAGE_NAME}-template`; +export const STORAGE_NAME_TEMPLATE_API = `${STORAGE_NAME_TEMPLATE}-api`; +export const STORAGE_NAME_TEMPLATE_API_WHISPER = `${STORAGE_NAME_TEMPLATE}-api-whisper`; +export const STORAGE_NAME_TEMPLATE_API_TTS = `${STORAGE_NAME_TEMPLATE}-api-tts`; +export const STORAGE_NAME_TEMPLATE_API_IMAGE_GEN = `${STORAGE_NAME_TEMPLATE}-api-image-gen`; +export const STORAGE_NAME_TEMPLATE_TOOLS = `${STORAGE_NAME_TEMPLATE}-tools`; \ No newline at end of file