This commit is contained in:
parent
2e7a23b117
commit
652da5ad86
@ -82,6 +82,36 @@
|
|||||||
:options="librarySelects"
|
:options="librarySelects"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="助理设置">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<n-switch
|
||||||
|
v-model:value="currentAssistant.disable_default_prompt"
|
||||||
|
>
|
||||||
|
</n-switch>
|
||||||
|
禁用默认提示词
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<n-switch v-model:value="currentAssistant.disable_memory">
|
||||||
|
</n-switch>
|
||||||
|
禁用记忆
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<n-switch
|
||||||
|
v-model:value="
|
||||||
|
currentAssistant.enable_memory_for_assistant_api
|
||||||
|
"
|
||||||
|
:disabled="currentAssistant.disable_memory"
|
||||||
|
>
|
||||||
|
</n-switch>
|
||||||
|
允许助理 API 读取记忆
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button type="primary" @click="editAssistant"> 更新 </n-button>
|
<n-button type="primary" @click="editAssistant"> 更新 </n-button>
|
||||||
<n-button type="error" @click="deleteAssistant" class="ml-2">
|
<n-button type="error" @click="deleteAssistant" class="ml-2">
|
||||||
@ -104,10 +134,10 @@
|
|||||||
<n-divider />
|
<n-divider />
|
||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between align-middle items-center">
|
<div class="flex justify-between align-middle items-center">
|
||||||
<n-h3>应用对接(原助理共享)</n-h3>
|
<n-h3>助理 API</n-h3>
|
||||||
<n-popconfirm @positive-click="createAssistantShare">
|
<n-popconfirm @positive-click="createAssistantKey">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<n-button tertiary> 新建对接 </n-button>
|
<n-button tertiary> 新 API </n-button>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
<div>
|
||||||
API Key 默认是没有请求限制的。为了防止 API Key
|
API Key 默认是没有请求限制的。为了防止 API Key
|
||||||
@ -119,16 +149,16 @@
|
|||||||
</n-popconfirm>
|
</n-popconfirm>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<n-list hoverable clickable v-if="assistantShares.length">
|
<n-list hoverable clickable v-if="assistantApiKeys.length">
|
||||||
<n-list-item v-for="c in assistantShares" :key="c.id">
|
<n-list-item v-for="c in assistantApiKeys" :key="c.id">
|
||||||
<n-thing>
|
<n-thing>
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div>
|
<div>
|
||||||
{{ c.token }}
|
{{ c.secret }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<n-popconfirm
|
<n-popconfirm
|
||||||
@positive-click="deleteAssistantShare(c.id ?? 0)"
|
@positive-click="deleteAssistantKey(c.id ?? 0)"
|
||||||
>
|
>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<n-button quaternary circle type="warning">
|
<n-button quaternary circle type="warning">
|
||||||
@ -150,7 +180,11 @@
|
|||||||
</n-drawer-content>
|
</n-drawer-content>
|
||||||
</n-drawer>
|
</n-drawer>
|
||||||
|
|
||||||
<n-drawer placement="left" v-model:show="showCreateDialog" :width="drawerWidth">
|
<n-drawer
|
||||||
|
placement="left"
|
||||||
|
v-model:show="showCreateDialog"
|
||||||
|
:width="drawerWidth"
|
||||||
|
>
|
||||||
<n-drawer-content closable title="新建助理">
|
<n-drawer-content closable title="新建助理">
|
||||||
<div v-if="currentAssistant">
|
<div v-if="currentAssistant">
|
||||||
<n-form>
|
<n-form>
|
||||||
@ -192,7 +226,7 @@ import { useChatStore } from "@/stores/chat";
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import {
|
import {
|
||||||
EntityAssistant,
|
EntityAssistant,
|
||||||
EntityAssistantShare,
|
EntityAssistantKey,
|
||||||
EntityAssistantTool,
|
EntityAssistantTool,
|
||||||
EntityLibrary,
|
EntityLibrary,
|
||||||
EntityTool,
|
EntityTool,
|
||||||
@ -210,7 +244,7 @@ const currentAssistant: Ref<EntityAssistant> = ref({});
|
|||||||
const assistants: Ref<EntityAssistant[]> = ref([]);
|
const assistants: Ref<EntityAssistant[]> = ref([]);
|
||||||
const librarySelects: any = ref([]);
|
const librarySelects: any = ref([]);
|
||||||
const libraries: Ref<EntityLibrary[]> = ref([]);
|
const libraries: Ref<EntityLibrary[]> = ref([]);
|
||||||
const assistantShares: Ref<EntityAssistantShare[]> = ref([]);
|
const assistantApiKeys: Ref<EntityAssistantKey[]> = ref([]);
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const drawerWidth = computed(() => {
|
const drawerWidth = computed(() => {
|
||||||
@ -246,7 +280,7 @@ const showEditAssistant = async (id: number) => {
|
|||||||
currentAssistantId.value = id;
|
currentAssistantId.value = id;
|
||||||
currentAssistant.value =
|
currentAssistant.value =
|
||||||
(await getApi().Assistant.apiV1AssistantsIdGet(id)).data.data ?? {};
|
(await getApi().Assistant.apiV1AssistantsIdGet(id)).data.data ?? {};
|
||||||
await getAssistantsShares();
|
await getAssistantsKeys();
|
||||||
|
|
||||||
getTools();
|
getTools();
|
||||||
};
|
};
|
||||||
@ -257,7 +291,7 @@ const editAssistant = async () => {
|
|||||||
currentAssistant.value
|
currentAssistant.value
|
||||||
);
|
);
|
||||||
await getAssistants();
|
await getAssistants();
|
||||||
await getAssistantsShares();
|
await getAssistantsKeys();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTools = async () => {
|
const getTools = async () => {
|
||||||
@ -308,28 +342,26 @@ const getAssistants = async () => {
|
|||||||
(await getApi().Assistant.apiV1AssistantsGet()).data.data ?? [];
|
(await getApi().Assistant.apiV1AssistantsGet()).data.data ?? [];
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAssistantsShares = async () => {
|
const getAssistantsKeys = async () => {
|
||||||
assistantShares.value =
|
assistantApiKeys.value =
|
||||||
(
|
(
|
||||||
await getApi().Assistant.apiV1AssistantsIdSharesGet(
|
await getApi().Assistant.apiV1AssistantsIdKeysGet(
|
||||||
currentAssistantId.value
|
currentAssistantId.value
|
||||||
)
|
)
|
||||||
).data.data ?? [];
|
).data.data ?? [];
|
||||||
};
|
};
|
||||||
|
|
||||||
const createAssistantShare = async () => {
|
const createAssistantKey = async () => {
|
||||||
await getApi().Assistant.apiV1AssistantsIdSharesPost(
|
await getApi().Assistant.apiV1AssistantsIdKeysPost(currentAssistantId.value);
|
||||||
currentAssistantId.value
|
await getAssistantsKeys();
|
||||||
);
|
|
||||||
await getAssistantsShares();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteAssistantShare = async (id: number) => {
|
const deleteAssistantKey = async (id: number) => {
|
||||||
await getApi().Assistant.apiV1AssistantsIdSharesShareIdDelete(
|
await getApi().Assistant.apiV1AssistantsIdKeysKeyIdDelete(
|
||||||
currentAssistantId.value,
|
currentAssistantId.value,
|
||||||
id
|
id
|
||||||
);
|
);
|
||||||
await getAssistantsShares();
|
await getAssistantsKeys();
|
||||||
};
|
};
|
||||||
|
|
||||||
getChats();
|
getChats();
|
||||||
|
Loading…
Reference in New Issue
Block a user