1
0
forked from Leaf/amber-ui

增加 对话单独的 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 type: string
owner: owner:
type: string type: string
prompt:
type: string
updated_at: updated_at:
type: string type: string
user_id: user_id:
@ -409,6 +411,9 @@ definitions:
name: name:
maxLength: 30 maxLength: 30
type: string type: string
prompt:
maxLength: 1024
type: string
required: required:
- name - name
type: object type: object
@ -472,6 +477,9 @@ definitions:
name: name:
maxLength: 30 maxLength: 30
type: string type: string
prompt:
maxLength: 1024
type: string
required: required:
- name - name
type: object type: object

View File

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

View File

@ -4,7 +4,9 @@
v-for="c in chatStore.chats" v-for="c in chatStore.chats"
:key="c.id" :key="c.id"
:class=" :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)" @click="viewChat(c.id ?? 0)"
> >
@ -71,6 +73,14 @@
/> />
</n-form-item> </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-button type="primary" @click="editChatPost"> 更新 </n-button>
</n-form> </n-form>
</div> </div>
@ -142,6 +152,7 @@ const editChatPost = async () => {
await getApi().Chat.apiV1ChatsIdPut(currentChatId.value, { await getApi().Chat.apiV1ChatsIdPut(currentChatId.value, {
name: currentChat.value?.name ?? "", name: currentChat.value?.name ?? "",
assistant_id: currentChat.value?.assistant_id, assistant_id: currentChat.value?.assistant_id,
prompt: currentChat.value?.prompt ?? "",
}); });
await getChats(); await getChats();
}; };