refac: move const STORAGE_NAME
This commit is contained in:
16
src/app.tsx
16
src/app.tsx
@@ -9,17 +9,13 @@ import { DefaultModel } from "@/const";
|
|||||||
import { Tr, langCodeContext, LANG_OPTIONS } from "@/translate";
|
import { Tr, langCodeContext, LANG_OPTIONS } from "@/translate";
|
||||||
import { ChatStore } from "@/types/chatstore";
|
import { ChatStore } from "@/types/chatstore";
|
||||||
import { newChatStore } from "@/types/newChatstore";
|
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) {
|
export function addTotalCost(cost: number) {
|
||||||
let totalCost = getTotalCost();
|
let totalCost = getTotalCost();
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import {
|
|||||||
STORAGE_NAME_TEMPLATE_API_TTS,
|
STORAGE_NAME_TEMPLATE_API_TTS,
|
||||||
STORAGE_NAME_TEMPLATE_API_WHISPER,
|
STORAGE_NAME_TEMPLATE_API_WHISPER,
|
||||||
STORAGE_NAME_TEMPLATE_TOOLS,
|
STORAGE_NAME_TEMPLATE_TOOLS,
|
||||||
|
} from "@/const";
|
||||||
|
import {
|
||||||
addTotalCost,
|
addTotalCost,
|
||||||
getTotalCost,
|
getTotalCost,
|
||||||
} from "@/app";
|
} from "@/app";
|
||||||
|
|||||||
11
src/const.ts
11
src/const.ts
@@ -1,3 +1,14 @@
|
|||||||
export const DefaultAPIEndpoint = "https://api.openai.com/v1/chat/completions";
|
export const DefaultAPIEndpoint = "https://api.openai.com/v1/chat/completions";
|
||||||
export const CHATGPT_API_WEB_VERSION = "v2.1.0";
|
export const CHATGPT_API_WEB_VERSION = "v2.1.0";
|
||||||
export const DefaultModel = "gpt-4o-mini";
|
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`;
|
||||||
Reference in New Issue
Block a user