mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-27 13:53:43 +08:00
llm config fix
This commit is contained in:
@@ -1129,6 +1129,7 @@
|
||||
"modelName",
|
||||
"name",
|
||||
"priority",
|
||||
"type",
|
||||
"url"
|
||||
],
|
||||
"type": "object",
|
||||
@@ -1143,6 +1144,9 @@
|
||||
"modelName": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"apiKey": {
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
1
frontend/src/api/types/schema.d.ts
vendored
1
frontend/src/api/types/schema.d.ts
vendored
@@ -545,6 +545,7 @@ export interface components {
|
||||
id: number;
|
||||
name: string;
|
||||
modelName: string;
|
||||
type: string;
|
||||
apiKey: string;
|
||||
url: string;
|
||||
enable: boolean;
|
||||
|
||||
@@ -34,6 +34,14 @@
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 "
|
||||
required />
|
||||
</div>
|
||||
<div class="col-span-2 sm:col-span-1">
|
||||
<label for="type" class="block mb-2 text-sm font-medium text-gray-900 ">类型</label>
|
||||
<select id="type" v-model="formData.type"
|
||||
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-500 focus:border-primary-500 block w-full p-2.5">
|
||||
<option :value="'CHAT'">聊天</option>
|
||||
<option :value="'EMBEDDING'">嵌入</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-span-2">
|
||||
<label for="apiKey" class="block mb-2 text-sm font-medium autocomplete text-gray-900 ">apiKey</label>
|
||||
<input type="text" id="apiKey" autocomplete="new-password" v-model="formData.apiKey"
|
||||
@@ -121,6 +129,9 @@ const handleSubmit = async () => {
|
||||
priority: z.number({
|
||||
message: "优先级必须为数字",
|
||||
}),
|
||||
type: z.string({
|
||||
message: "类型不能为空",
|
||||
}),
|
||||
});
|
||||
const validatedData = llmSchema.parse(formData.value);
|
||||
await onSubmit(validatedData);
|
||||
|
||||
11
frontend/src/composables/ai/useAiAction.ts
Normal file
11
frontend/src/composables/ai/useAiAction.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import client from "../../api/client";
|
||||
|
||||
const useAiAction = () => {
|
||||
const actionChat = (message: string) => {
|
||||
return client.POST("/ai/action/chat", {
|
||||
body: message,
|
||||
});
|
||||
};
|
||||
|
||||
return { actionChat };
|
||||
};
|
||||
@@ -40,6 +40,7 @@
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">名称</th>
|
||||
<th scope="col" class="px-6 py-3">模型名称</th>
|
||||
<th scope="col" class="px-6 py-3">类型</th>
|
||||
<th scope="col" class="px-6 py-3">apiKey</th>
|
||||
<th scope="col" class="px-6 py-3">url</th>
|
||||
<th scope="col" class="px-6 py-3">状态</th>
|
||||
@@ -62,6 +63,9 @@
|
||||
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">{{
|
||||
`${llm.modelName}` }}
|
||||
</td>
|
||||
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">{{
|
||||
llm.type === 'CHAT' ? '聊天' : '嵌入' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">{{
|
||||
llm.apiKey }}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user