diff --git a/src/components/submissions/ChainModal.vue b/src/components/submissions/ChainModal.vue
index 3a07298..5808d8c 100644
--- a/src/components/submissions/ChainModal.vue
+++ b/src/components/submissions/ChainModal.vue
@@ -130,20 +130,40 @@
gap: 8px;
"
>
- {{ round.question }}
-
+
+
{{ round.source === "conversation" ? "对话" : "手动" }}
+ >{{
+ round.source === "conversation" ? "对话" : "手动"
+ }}
L{{ round.prompt_level }}
+
+
+ {{ isExpanded(index) ? "收起" : "展开" }}
+
()
-const canDelete = computed(() => roleSuper.value || (!!props.username && props.username === user.username))
+const canDelete = computed(
+ () =>
+ roleSuper.value || (!!props.username && props.username === user.username),
+)
defineEmits<{ "update:show": [value: boolean] }>()
const loading = ref(false)
const selectedRound = ref(0)
+const expandedRounds = ref>(new Set())
type ChainRound = Omit & {
source: string | null
assistantMsgId: number | null
@@ -252,11 +294,34 @@ const selectedPageHtml = computed(() => {
return `${style}${round.html}${script}`
})
+function renderMarkdown(text: string): string {
+ return marked.parse(text) as string
+}
+
+function isPromptLong(text: string): boolean {
+ return text.length > 220 || text.split(/\r?\n/).length > 4
+}
+
+function isExpanded(index: number): boolean {
+ return expandedRounds.value.has(index)
+}
+
+function toggleExpanded(index: number) {
+ const next = new Set(expandedRounds.value)
+ if (next.has(index)) {
+ next.delete(index)
+ } else {
+ next.add(index)
+ }
+ expandedRounds.value = next
+}
+
async function loadMessages() {
if (!props.submissionId) return
loading.value = true
rounds.value = []
selectedRound.value = 0
+ expandedRounds.value = new Set()
try {
const data = await Submission.getPromptChain(props.submissionId)
rounds.value = data.map((round) => ({
@@ -280,3 +345,44 @@ watch(
},
)
+
+