update
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 ?? "删除失败,请重试")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
await Prompt.deleteMessagePair(round.assistantMsgId)
|
try {
|
||||||
|
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)
|
||||||
|
|||||||
@@ -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) {
|
||||||
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)
|
const items = expandedData.get(parentId)
|
||||||
if (items)
|
if (items)
|
||||||
expandedData.set(
|
expandedData.set(
|
||||||
|
|||||||
Reference in New Issue
Block a user