This commit is contained in:
ivamp 2024-08-17 17:30:47 +08:00
parent 6ac7af786d
commit 3630d8eae3
6 changed files with 13 additions and 31 deletions

View File

@ -71,7 +71,7 @@
<p>主页地址: {{ tool.data?.homepage_url }}</p> <p>主页地址: {{ tool.data?.homepage_url }}</p>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn color="primary" @click="bindTool(tool.id ?? '')">绑定</v-btn> <v-btn color="primary" @click="bindTool(tool.id)">绑定</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-col> </v-col>
@ -157,7 +157,7 @@ function refresh() {
getBindedTools(); getBindedTools();
} }
function bindTool(toolId: string) { function bindTool(toolId: Number | undefined) {
api.Assistant.apiV1AssistantsIdToolsToolIdPost(assistantId, Number(toolId)) api.Assistant.apiV1AssistantsIdToolsToolIdPost(assistantId, Number(toolId))
.then(() => { .then(() => {
refresh(); refresh();

View File

@ -26,8 +26,8 @@
<p>API Key: {{ s.token }}</p> <p>API Key: {{ s.token }}</p>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn color="primary" @click="goto(s.token ?? '')">访问</v-btn> <v-btn color="primary" @click="goto(s.token)">访问</v-btn>
<v-btn color="error" @click="deleteShare(s.id ?? '')">删除</v-btn> <v-btn color="error" @click="deleteShare(s.id)">删除</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-col> </v-col>
@ -78,7 +78,7 @@ function createShare() {
}); });
} }
function deleteShare(shareId: string) { function deleteShare(shareId: string | undefined | Number) {
api.Assistant.apiV1AssistantsIdSharesShareIdDelete( api.Assistant.apiV1AssistantsIdSharesShareIdDelete(
assistantId, assistantId,
Number(shareId), Number(shareId),

View File

@ -22,14 +22,14 @@
<p>Phone: {{ assistant.phone }}</p> --> <p>Phone: {{ assistant.phone }}</p> -->
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn color="primary" @click="showChats(assistant.id ?? '')"> <v-btn color="primary" @click="showChats(assistant.id)">
对话 对话
</v-btn> </v-btn>
<v-btn color="primary" @click="editAssistant(assistant.id ?? '')" <v-btn color="primary" @click="editAssistant(assistant.id)"
>编辑</v-btn >编辑</v-btn
> >
<v-btn color="error" @click="deleteAssistant(assistant.id ?? '')" <v-btn color="error" @click="deleteAssistant(assistant.id)"
>删除</v-btn >删除</v-btn
> >
</v-card-actions> </v-card-actions>
@ -88,7 +88,7 @@ const deleteResult = ref({
message: "", message: "",
}); });
function deleteAssistant(assistantId: string) { function deleteAssistant(assistantId: string | undefined | number) {
selectedAssistantId.value = Number(assistantId); selectedAssistantId.value = Number(assistantId);
dialog.value = true; dialog.value = true;
} }
@ -107,11 +107,11 @@ function deleteAssistantConfirmed() {
refresh(); refresh();
} }
function editAssistant(assistantId: string) { function editAssistant(assistantId: string | undefined | number) {
router.push(`/assistants/${assistantId}/edit`); router.push(`/assistants/${assistantId}/edit`);
} }
function showChats(assistantId: string) { function showChats(assistantId: string | undefined | number) {
router.push(`/assistants/${assistantId}/chats`); router.push(`/assistants/${assistantId}/chats`);
} }

View File

@ -93,6 +93,7 @@ function sendMessage() {
toolError.value = false; toolError.value = false;
api.ChatMessage.apiV1ChatsIdMessagesPost(chatId, { api.ChatMessage.apiV1ChatsIdMessagesPost(chatId, {
message: input.value, message: input.value,
role: "user",
}) })
.then((res) => { .then((res) => {
const newMessage = { const newMessage = {

View File

@ -1,20 +0,0 @@
<template>
<h3>Ping 与服务器连通性测试</h3>
<div class="mt-3 mb-3">
<v-btn color="primary" @click="greet()">Greet</v-btn>
</div>
<p v-if="response != ''">服务器回应{{ response }}</p>
</template>
<script setup lang="ts">
import { api } from "@/plugins/api";
import { ref } from "vue";
const response = ref("");
function greet() {
api.Ping.apiV1PingGet().then((res) => {
response.value = "用户 ID" + String(res.data.data?.userId);
});
}
</script>

View File

@ -127,6 +127,7 @@ function sendMessage() {
message: input.value, message: input.value,
assistant_token: publicChatInfo.value.assistant_token, assistant_token: publicChatInfo.value.assistant_token,
guest_id: publicChatStore.guest_id, guest_id: publicChatStore.guest_id,
role: "user",
}) })
.then((res) => { .then((res) => {
const newMessage = { const newMessage = {