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) emit("deleted", item.assistant_message_id)
naiveMessage.success("已删除") naiveMessage.success("已删除")
} catch { } catch (error: any) {
naiveMessage.error("删除失败,请重试") naiveMessage.error(error.response?.data?.detail ?? "删除失败,请重试")
} finally { } finally {
deletingId.value = null deletingId.value = null
} }

View File

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

View File

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

View File

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