diff --git a/app/src-tauri/tauri.conf.json b/app/src-tauri/tauri.conf.json index 83488f21..cc451930 100644 --- a/app/src-tauri/tauri.conf.json +++ b/app/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "chatnio", - "version": "3.10.8" + "version": "3.10.9" }, "tauri": { "allowlist": { diff --git a/app/src/admin/channel.ts b/app/src/admin/channel.ts index 7d98980d..9cd8818c 100644 --- a/app/src/admin/channel.ts +++ b/app/src/admin/channel.ts @@ -187,13 +187,9 @@ export const ChannelInfos: Record = { chatglm: { endpoint: "https://open.bigmodel.cn", format: "", - models: [ - "glm-4", - "glm-4v", - "glm-3-turbo" - ], + models: ["glm-4", "glm-4v", "glm-3-turbo"], description: - "> 智谱 ChatGLM 密钥格式为 **api-key**,接入点填写 *https://open.bigmodel.cn* \n" + "> 智谱 ChatGLM 密钥格式为 **api-key**,接入点填写 *https://open.bigmodel.cn* \n", }, qwen: { endpoint: "https://dashscope.aliyuncs.com", @@ -297,4 +293,4 @@ export function getChannelType(type?: string): string { export function getShortChannelType(type?: string): string { if (type && type in ShortChannelTypes) return ShortChannelTypes[type]; return ShortChannelTypes.openai; -} \ No newline at end of file +} diff --git a/app/src/admin/datasets/charge.ts b/app/src/admin/datasets/charge.ts index 3e4cfdec..8f9064ca 100644 --- a/app/src/admin/datasets/charge.ts +++ b/app/src/admin/datasets/charge.ts @@ -173,7 +173,12 @@ export const pricing: PricingDataset = [ currency: Currency.CNY, }, { - models: ["zhipu-chatglm-lite", "zhipu-chatglm-std", "zhipu-chatglm-turbo", "glm-3-turbo"], + models: [ + "zhipu-chatglm-lite", + "zhipu-chatglm-std", + "zhipu-chatglm-turbo", + "glm-3-turbo", + ], input: 0.005, output: 0.005, currency: Currency.CNY, diff --git a/app/src/api/auth.ts b/app/src/api/auth.ts index 1d340451..c6178c56 100644 --- a/app/src/api/auth.ts +++ b/app/src/api/auth.ts @@ -85,10 +85,14 @@ export async function doRegister( } } -export async function doVerify(email: string, checkout?: boolean): Promise { +export async function doVerify( + email: string, + checkout?: boolean, +): Promise { try { const response = await axios.post("/verify", { - email, checkout, + email, + checkout, } as VerifyForm); return response.data as VerifyResponse; } catch (e) { @@ -132,4 +136,4 @@ export async function sendCode( }); return res.status; -} \ No newline at end of file +} diff --git a/app/src/api/file.ts b/app/src/api/file.ts index 9e67164a..ebbf3fa6 100644 --- a/app/src/api/file.ts +++ b/app/src/api/file.ts @@ -1,5 +1,6 @@ import axios from "axios"; import { blobEndpoint } from "@/conf/env.ts"; +import { trimSuffixes } from "@/utils/base.ts"; export type BlobParserResponse = { status: boolean; @@ -15,11 +16,16 @@ export type FileObject = { export type FileArray = FileObject[]; -export async function blobParser(file: File): Promise { +export async function blobParser( + file: File, + model: string, +): Promise { + const endpoint = trimSuffixes(blobEndpoint, ["/upload", "/"]); + try { const resp = await axios.post( - `${blobEndpoint}/upload`, - { file }, + `${endpoint}/upload`, + { file, model }, { headers: { "Content-Type": "multipart/form-data" }, }, diff --git a/app/src/components/FileProvider.tsx b/app/src/components/FileProvider.tsx index ab927952..728e6259 100644 --- a/app/src/components/FileProvider.tsx +++ b/app/src/components/FileProvider.tsx @@ -77,7 +77,7 @@ function FileProvider({ files, dispatch }: FileProviderProps) { }); }, 2000); - const resp = await blobParser(file); + const resp = await blobParser(file, model); clearTimeout(timeout); if (!resp.status) { diff --git a/app/src/components/admin/ChargeWidget.tsx b/app/src/components/admin/ChargeWidget.tsx index 70662ced..b138596c 100644 --- a/app/src/components/admin/ChargeWidget.tsx +++ b/app/src/components/admin/ChargeWidget.tsx @@ -102,9 +102,9 @@ function reducer(state: ChargeProps, action: any): ChargeProps { if (action.payload.trim().length === 0) return state; return state.models.includes(action.payload) ? { - ...state, - models: state.models.filter((model) => model !== action.payload), - } + ...state, + models: state.models.filter((model) => model !== action.payload), + } : { ...state, models: [...state.models, action.payload] }; case "remove-model": return { diff --git a/app/src/components/app/Announcement.tsx b/app/src/components/app/Announcement.tsx index 82d4b4c9..ba2be896 100644 --- a/app/src/components/app/Announcement.tsx +++ b/app/src/components/app/Announcement.tsx @@ -41,7 +41,7 @@ function Announcement() { > - + diff --git a/app/src/components/ui/combo-box.tsx b/app/src/components/ui/combo-box.tsx index cf3bc481..3df22bb2 100644 --- a/app/src/components/ui/combo-box.tsx +++ b/app/src/components/ui/combo-box.tsx @@ -40,7 +40,7 @@ export function Combobox({ const [open, setOpen] = React.useState(defaultOpen ?? false); const valueList = React.useMemo((): string[] => { // list set (if some element in current value is not in list, it will be added) - const seq = [...list, (value ?? "")].filter((v) => v); + const seq = [...list, value ?? ""].filter((v) => v); const set = new Set(seq); return [...set]; }, [list]); diff --git a/app/src/components/ui/dialog.tsx b/app/src/components/ui/dialog.tsx index 889b2767..244f387c 100644 --- a/app/src/components/ui/dialog.tsx +++ b/app/src/components/ui/dialog.tsx @@ -142,7 +142,6 @@ const DialogAction = React.forwardRef( ); DialogAction.displayName = "DialogAction"; - export { Dialog, DialogTrigger, diff --git a/app/src/conf/bootstrap.ts b/app/src/conf/bootstrap.ts index 213bc508..21d95b0c 100644 --- a/app/src/conf/bootstrap.ts +++ b/app/src/conf/bootstrap.ts @@ -7,7 +7,7 @@ import { import { syncSiteInfo } from "@/admin/api/info.ts"; import { setAxiosConfig } from "@/conf/api.ts"; -export const version = "3.10.8"; // version of the current build +export const version = "3.10.9"; // version of the current build export const dev: boolean = getDev(); // is in development mode (for debugging, in localhost origin) export const deploy: boolean = true; // is production environment (for api endpoint) export const tokenField = getTokenField(deploy); // token field name for storing token diff --git a/app/src/routes/Generation.tsx b/app/src/routes/Generation.tsx index cb40a304..248b04b4 100644 --- a/app/src/routes/Generation.tsx +++ b/app/src/routes/Generation.tsx @@ -74,7 +74,7 @@ function Wrapper({ onSend }: WrapperProps) { const target = ref.current as HTMLInputElement | null; if (!target) return; target.focus(); - target.removeEventListener("keydown", () => { }); + target.removeEventListener("keydown", () => {}); target.addEventListener("keydown", (e) => { if (isEnter(e)) { // cannot use model here, because model is not updated @@ -86,7 +86,7 @@ function Wrapper({ onSend }: WrapperProps) { ref.current && (ref.current as HTMLInputElement).removeEventListener( "keydown", - () => { }, + () => {}, ); }; }, [ref]); diff --git a/app/src/routes/admin/System.tsx b/app/src/routes/admin/System.tsx index 4eb319a9..b71feda6 100644 --- a/app/src/routes/admin/System.tsx +++ b/app/src/routes/admin/System.tsx @@ -845,7 +845,9 @@ function Search({ data, dispatch, onChange }: CompProps) { max={50} /> - {t("admin.system.searchTip")} + + {t("admin.system.searchTip")} +