refac: move const STORAGE_NAME

This commit is contained in:
2024-10-15 15:04:27 +08:00
parent 1fbd4ee87b
commit ad291bd72e
3 changed files with 19 additions and 10 deletions

View File

@@ -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();

View File

@@ -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";

View File

@@ -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`;