增加 对话单独的 prompt 设置

This commit is contained in:
ivamp 2024-09-27 00:13:00 +08:00
parent f58bd666e0
commit 05fd26284f
3 changed files with 38 additions and 1 deletions

View File

@ -80,6 +80,8 @@ definitions:
type: string
owner:
type: string
prompt:
type: string
updated_at:
type: string
user_id:
@ -409,6 +411,9 @@ definitions:
name:
maxLength: 30
type: string
prompt:
maxLength: 1024
type: string
required:
- name
type: object
@ -472,6 +477,9 @@ definitions:
name:
maxLength: 30
type: string
prompt:
maxLength: 1024
type: string
required:
- name
type: object

View File

@ -949,6 +949,12 @@ export interface EntityChat {
* @memberof EntityChat
*/
'owner'?: string;
/**
*
* @type {string}
* @memberof EntityChat
*/
'prompt'?: string;
/**
*
* @type {string}
@ -1665,6 +1671,12 @@ export interface SchemaChatCreateRequest {
* @memberof SchemaChatCreateRequest
*/
'name': string;
/**
*
* @type {string}
* @memberof SchemaChatCreateRequest
*/
'prompt'?: string;
}
/**
*
@ -1790,6 +1802,12 @@ export interface SchemaChatUpdateRequest {
* @memberof SchemaChatUpdateRequest
*/
'name': string;
/**
*
* @type {string}
* @memberof SchemaChatUpdateRequest
*/
'prompt'?: string;
}
/**
*

View File

@ -4,7 +4,9 @@
v-for="c in chatStore.chats"
:key="c.id"
:class="
c.id === chatStore.currentChat?.id ? ' bg-gray-100 dark:bg-gray-700' : ''
c.id === chatStore.currentChat?.id
? ' bg-gray-100 dark:bg-gray-700'
: ''
"
@click="viewChat(c.id ?? 0)"
>
@ -71,6 +73,14 @@
/>
</n-form-item>
<n-form-item label="提示词(将禁用系统默认提示词)">
<n-input
type="textarea"
v-model:value="currentChat.prompt"
@keydown.enter.prevent
/>
</n-form-item>
<n-button type="primary" @click="editChatPost"> 更新 </n-button>
</n-form>
</div>
@ -142,6 +152,7 @@ const editChatPost = async () => {
await getApi().Chat.apiV1ChatsIdPut(currentChatId.value, {
name: currentChat.value?.name ?? "",
assistant_id: currentChat.value?.assistant_id,
prompt: currentChat.value?.prompt ?? "",
});
await getChats();
};