update
Some checks failed
Deploy / deploy (build, debian, 22) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822) (push) Has been cancelled

This commit is contained in:
2026-06-11 21:24:50 -06:00
parent c12c77ac7e
commit 5bb8a1eaa3
4 changed files with 21 additions and 8 deletions

View File

@@ -194,8 +194,8 @@ async function deleteItem(item: HistoryViewItem, e: Event) {
}
emit("deleted", item.assistant_message_id)
naiveMessage.success("已删除")
} catch {
naiveMessage.error("删除失败,请重试")
} catch (error: any) {
naiveMessage.error(error.response?.data?.detail ?? "删除失败,请重试")
} finally {
deletingId.value = null
}

View File

@@ -207,8 +207,8 @@ async function deletePair(assistantMsgId: number) {
removeMessagePair(assistantMsgId)
naiveMessage.success("已删除")
emit("deleted")
} catch {
naiveMessage.error("删除失败,请重试")
} catch (error: any) {
naiveMessage.error(error.response?.data?.detail ?? "删除失败,请重试")
}
}

View File

@@ -238,13 +238,15 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue"
import { NPopconfirm, NButton } from "naive-ui"
import { NPopconfirm, NButton, useMessage } from "naive-ui"
import { Icon } from "@iconify/vue"
import { marked } from "marked"
import { Prompt, Submission } from "../../api"
import type { PromptRound } from "../../utils/type"
import { user, roleSuper } from "../../store/user"
const message = useMessage()
const props = defineProps<{
show: boolean
submissionId: string
@@ -270,7 +272,12 @@ const rounds = ref<ChainRound[]>([])
async function deleteRound(index: number) {
const round = rounds.value[index]
if (!round.assistantMsgId) return
await Prompt.deleteMessagePair(round.assistantMsgId)
try {
await Prompt.deleteMessagePair(round.assistantMsgId)
} catch (error: any) {
message.error(error.response?.data?.detail ?? "删除失败,请重试")
return
}
await loadMessages()
if (selectedRound.value >= rounds.value.length) {
selectedRound.value = Math.max(0, rounds.value.length - 1)

View File

@@ -97,7 +97,7 @@
<script setup lang="ts">
import { computed, h, onMounted, onUnmounted, reactive, ref, watch } from "vue"
import { NButton, NDataTable, NTag, type DataTableColumn } from "naive-ui"
import { NButton, NDataTable, NTag, useMessage, type DataTableColumn } from "naive-ui"
import { Icon } from "@iconify/vue"
import { Submission } from "../api"
import type { SubmissionOut, FlagType } from "../utils/type"
@@ -122,6 +122,7 @@ import { roleAdmin, roleSuper, user } from "../store/user"
const route = useRoute()
const router = useRouter()
const message = useMessage()
// 列表数据
const data = ref<SubmissionOut[]>([])
@@ -304,7 +305,12 @@ async function handleExpand(keys: (string | number)[]) {
}
async function handleDelete(row: SubmissionOut, parentId: string) {
await Submission.delete(row.id)
try {
await Submission.delete(row.id)
} catch (error: any) {
message.error(error.response?.data?.detail ?? "删除失败请重试")
return
}
const items = expandedData.get(parentId)
if (items)
expandedData.set(