1
0
forked from Leaf/amber-ui

改进 前端

This commit is contained in:
ivamp 2024-10-08 11:05:48 +08:00
parent 0a86bab892
commit 97574df592
5 changed files with 25 additions and 118 deletions

View File

@ -24,6 +24,8 @@ definitions:
type: boolean
temperature:
type: number
total_token_usage:
type: integer
updated_at:
type: string
user_id:
@ -299,6 +301,8 @@ definitions:
- system
- system_hide
- assistant
- system_override
- user_later
type: string
required:
- assistant_key
@ -430,7 +434,8 @@ definitions:
- system
- system_hide
- assistant
- image
- system_override
- user_later
type: string
variables:
additionalProperties:

View File

@ -796,6 +796,12 @@ export interface EntityAssistant {
* @memberof EntityAssistant
*/
'temperature'?: number;
/**
*
* @type {number}
* @memberof EntityAssistant
*/
'total_token_usage'?: number;
/**
*
* @type {string}
@ -1506,7 +1512,9 @@ export const SchemaAddPublicChatMessageRequestRoleEnum = {
UserHide: 'user_hide',
System: 'system',
SystemHide: 'system_hide',
Assistant: 'assistant'
Assistant: 'assistant',
SystemOverride: 'system_override',
UserLater: 'user_later'
} as const;
export type SchemaAddPublicChatMessageRequestRoleEnum = typeof SchemaAddPublicChatMessageRequestRoleEnum[keyof typeof SchemaAddPublicChatMessageRequestRoleEnum];
@ -1716,7 +1724,8 @@ export const SchemaChatMessageAddRequestRoleEnum = {
System: 'system',
SystemHide: 'system_hide',
Assistant: 'assistant',
Image: 'image'
SystemOverride: 'system_override',
UserLater: 'user_later'
} as const;
export type SchemaChatMessageAddRequestRoleEnum = typeof SchemaChatMessageAddRequestRoleEnum[keyof typeof SchemaChatMessageAddRequestRoleEnum];

View File

@ -1,104 +0,0 @@
<template>
<p>在做了在做了</p>
<div v-if="assistants.length">
<n-list hoverable clickable>
<n-list-item v-for="c in assistants" :key="c.id">
<n-thing>
<div class="flex justify-between items-center">
<div>
{{ c.name }}
<br />
{{ c.description }}
</div>
<div>
<n-button
quaternary
circle
type="info"
>
<template #icon>
<n-icon size="16" class="cursor-pointer">
<SettingsOutline />
</n-icon>
</template>
</n-button>
</div>
</div>
</n-thing>
</n-list-item>
</n-list>
</div>
<div v-else class="text-center">
<n-result
status="404"
title="目前没有共享的助理"
description="你可以在这里收藏别人发布的助理,并使用它。"
>
<n-button type="primary"> 在做了在做了 </n-button>
</n-result>
</div>
</template>
<script lang="ts" setup>
import { useDialog } from "naive-ui";
import {
TrashBinOutline,
SettingsOutline,
HelpCircleOutline,
} from "@vicons/ionicons5";
import getApi from "@/plugins/api";
import { useChatStore } from "@/stores/chat";
import { ref } from "vue";
import {
EntityAssistant,
EntityAssistantKey,
EntityAssistantTool,
EntityLibrary,
EntityTool,
SchemaAssistantPublic,
} from "@/api";
import { useIsMobile } from "@/utils/composables";
const currentAssistantTools: Ref<EntityAssistantTool[]> = ref([]);
const currentAssistantId = ref();
const assistants: Ref<SchemaAssistantPublic[]> = ref([]);
const assistantApiKeys: Ref<EntityAssistantKey[]> = ref([]);
const isMobile = useIsMobile();
const drawerWidth = computed(() => {
if (isMobile.value) {
return window.innerWidth;
} else {
return window.innerWidth * 0.6;
}
});
const getAssistants = async () => {
getApi()
.Assistant.apiV1AssistantsPublicGet(1)
.then((r) => {
assistants.value = r.data.data?.data ?? [];
});
};
// const bindOrUnbind = async (id: number) => {
// let binded = findTool(id);
// if (binded) {
// await getApi().Assistant.apiV1AssistantsIdToolsToolIdDelete(
// currentAssistantId.value,
// id
// );
// } else {
// await getApi().Assistant.apiV1AssistantsIdToolsToolIdPost(
// currentAssistantId.value,
// id
// );
// }
// };
getAssistants();
</script>

View File

@ -111,11 +111,8 @@
</div>
<div>
<n-switch
v-model:value="currentAssistant.public"
>
</n-switch>
公开分享助理
<n-switch v-model:value="currentAssistant.public"> </n-switch>
公开分享助理(弃用)
</div>
<div class="mt-3">
@ -127,6 +124,10 @@
:max="1"
/>
</div>
<div class="mt-3">
Token 用量: {{ currentAssistant.total_token_usage }}
</div>
</div>
</n-form-item>

View File

@ -1,7 +1,3 @@
<script setup lang="ts">
import AssistantPublistSettings from './AssistantPublistSettings.vue';
</script>
<template>
<n-tabs type="segment" animated class="select-none">
<n-tab-pane name="chat" tab="对话">
@ -10,9 +6,9 @@ import AssistantPublistSettings from './AssistantPublistSettings.vue';
<n-tab-pane name="assistant" tab="助理">
<AssistantSettings />
</n-tab-pane>
<n-tab-pane name="assistant_public" tab="发布">
<!-- <n-tab-pane name="assistant_public" tab="发布">
<AssistantPublistSettings />
</n-tab-pane>
</n-tab-pane> -->
<n-tab-pane name="tool" tab="工具">
<ToolSettings />
</n-tab-pane>