From 229fab833c8bdfef43569d4cfd6f3009c006a516 Mon Sep 17 00:00:00 2001 From: Json_Lee <2622336659@qq.com> Date: Mon, 12 May 2025 23:53:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 8 ++++++++ src/api/chat/types.ts | 4 +++- src/constants/enums.ts | 7 +++++++ src/pages/chat/index.vue | 3 ++- 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/constants/enums.ts diff --git a/package.json b/package.json index 6deb1ba..8de5f46 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "fix": "eslint . --fix" }, "dependencies": { + "@jsonlee_12138/enum": "^1.0.1", "element-plus": "^2.9.8", "hook-fetch": "^1.0.1", "pinia": "^3.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe19e25..bdf20db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@jsonlee_12138/enum': + specifier: ^1.0.1 + version: 1.0.1 element-plus: specifier: ^2.9.8 version: 2.9.8(vue@3.5.13(typescript@5.7.3)) @@ -644,6 +647,9 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@jsonlee_12138/enum@1.0.1': + resolution: {integrity: sha512-33Zgvu3Oi0FblWdyuOOU1oFr1GDxNMloyVRPDMc+riOPZlQcP+TdHJODd6lZuZWOETPCIyaBdYaElZe0XoyZsA==} + '@jsonlee_12138/markdown-it-mermaid@0.0.3': resolution: {integrity: sha512-PLIexJKys3ml67M5NmTJv+8hZUX36VwHLvbW82QfxVzMCfiutigA2qjrvLZd/WjSr6Ut9vbSwgAlh9CMLPA8SQ==} peerDependencies: @@ -4606,6 +4612,8 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@jsonlee_12138/enum@1.0.1': {} + '@jsonlee_12138/markdown-it-mermaid@0.0.3(markdown-it@14.1.0)(mermaid@11.6.0)': dependencies: markdown-it: 14.1.0 diff --git a/src/api/chat/types.ts b/src/api/chat/types.ts index b822a2f..4d5d6f1 100644 --- a/src/api/chat/types.ts +++ b/src/api/chat/types.ts @@ -1,3 +1,5 @@ +import type { ModelType } from '@/constants/enums'; + /** * ChatRequest,描述:对话请求对象 */ @@ -19,7 +21,7 @@ export interface SendDTO { */ kid?: string; messages: Message[]; - model: string; + model: ModelType; /** * 提示词 */ diff --git a/src/constants/enums.ts b/src/constants/enums.ts new file mode 100644 index 0000000..a5235d2 --- /dev/null +++ b/src/constants/enums.ts @@ -0,0 +1,7 @@ +import type { EnumValue } from '@jsonlee_12138/enum'; +import Enum from '@jsonlee_12138/enum'; + +export const ModelEnum = Enum.create({ + GPT_4o_MINI: Enum.Item('gpt-4o-mini'), +}); +export type ModelType = EnumValue; diff --git a/src/pages/chat/index.vue b/src/pages/chat/index.vue index 378674b..5ad6cc7 100644 --- a/src/pages/chat/index.vue +++ b/src/pages/chat/index.vue @@ -1,6 +1,7 @@