feat: 新增枚举定义
This commit is contained in:
parent
7ccfc4a10c
commit
229fab833c
@ -12,6 +12,7 @@
|
|||||||
"fix": "eslint . --fix"
|
"fix": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@jsonlee_12138/enum": "^1.0.1",
|
||||||
"element-plus": "^2.9.8",
|
"element-plus": "^2.9.8",
|
||||||
"hook-fetch": "^1.0.1",
|
"hook-fetch": "^1.0.1",
|
||||||
"pinia": "^3.0.2",
|
"pinia": "^3.0.2",
|
||||||
|
|||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -8,6 +8,9 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@jsonlee_12138/enum':
|
||||||
|
specifier: ^1.0.1
|
||||||
|
version: 1.0.1
|
||||||
element-plus:
|
element-plus:
|
||||||
specifier: ^2.9.8
|
specifier: ^2.9.8
|
||||||
version: 2.9.8(vue@3.5.13(typescript@5.7.3))
|
version: 2.9.8(vue@3.5.13(typescript@5.7.3))
|
||||||
@ -644,6 +647,9 @@ packages:
|
|||||||
'@jridgewell/trace-mapping@0.3.25':
|
'@jridgewell/trace-mapping@0.3.25':
|
||||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
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':
|
'@jsonlee_12138/markdown-it-mermaid@0.0.3':
|
||||||
resolution: {integrity: sha512-PLIexJKys3ml67M5NmTJv+8hZUX36VwHLvbW82QfxVzMCfiutigA2qjrvLZd/WjSr6Ut9vbSwgAlh9CMLPA8SQ==}
|
resolution: {integrity: sha512-PLIexJKys3ml67M5NmTJv+8hZUX36VwHLvbW82QfxVzMCfiutigA2qjrvLZd/WjSr6Ut9vbSwgAlh9CMLPA8SQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -4606,6 +4612,8 @@ snapshots:
|
|||||||
'@jridgewell/resolve-uri': 3.1.2
|
'@jridgewell/resolve-uri': 3.1.2
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
'@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)':
|
'@jsonlee_12138/markdown-it-mermaid@0.0.3(markdown-it@14.1.0)(mermaid@11.6.0)':
|
||||||
dependencies:
|
dependencies:
|
||||||
markdown-it: 14.1.0
|
markdown-it: 14.1.0
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import type { ModelType } from '@/constants/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChatRequest,描述:对话请求对象
|
* ChatRequest,描述:对话请求对象
|
||||||
*/
|
*/
|
||||||
@ -19,7 +21,7 @@ export interface SendDTO {
|
|||||||
*/
|
*/
|
||||||
kid?: string;
|
kid?: string;
|
||||||
messages: Message[];
|
messages: Message[];
|
||||||
model: string;
|
model: ModelType;
|
||||||
/**
|
/**
|
||||||
* 提示词
|
* 提示词
|
||||||
*/
|
*/
|
||||||
|
|||||||
7
src/constants/enums.ts
Normal file
7
src/constants/enums.ts
Normal file
@ -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<typeof ModelEnum>;
|
||||||
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { createSession } from '@/api';
|
import { createSession } from '@/api';
|
||||||
import { send } from '@/api/chat';
|
import { send } from '@/api/chat';
|
||||||
|
import { ModelEnum } from '@/constants/enums';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { useChatStore } from '@/store/modules/chat';
|
import { useChatStore } from '@/store/modules/chat';
|
||||||
import { BubbleList, Sender } from 'vue-element-plus-x';
|
import { BubbleList, Sender } from 'vue-element-plus-x';
|
||||||
@ -61,7 +62,7 @@ async function handleSend() {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
const req = send({
|
const req = send({
|
||||||
sessionId: chatId.value,
|
sessionId: chatId.value,
|
||||||
model: 'gpt-4o-mini',
|
model: ModelEnum.GPT_4o_MINI.value,
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: 'user',
|
role: 'user',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user