update
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

This commit is contained in:
2026-05-09 03:29:20 -06:00
parent 315df11b5d
commit 3bf24ce319
2 changed files with 40 additions and 59 deletions

View File

@@ -71,6 +71,18 @@ const evaluation = ref<Evaluation>({
criteria_details: {}, criteria_details: {},
}) })
const page = ref(1) const page = ref(1)
const suggestionLines = computed(() =>
splitSuggestionLines(evaluation.value.suggestions),
)
function splitSuggestionLines(suggestions?: string | null) {
return suggestions
? suggestions
.split("\n")
.map((suggestion) => suggestion.trim())
.filter(Boolean)
: []
}
// ==================== WebSocket 相关函数 ==================== // ==================== WebSocket 相关函数 ====================
// 处理 WebSocket 消息 // 处理 WebSocket 消息
@@ -306,7 +318,7 @@ onUnmounted(() => {
</n-gi> </n-gi>
<!-- 右侧评分详情区域 --> <!-- 右侧评分详情区域 -->
<n-gi :span="2" style="max-height: 550px; overflow: auto;"> <n-gi :span="2" style="max-height: 550px; overflow: auto">
<!-- AI反馈 --> <!-- AI反馈 -->
<n-card <n-card
v-if="evaluation.feedback" v-if="evaluation.feedback"
@@ -319,12 +331,19 @@ onUnmounted(() => {
<!-- 改进建议 --> <!-- 改进建议 -->
<n-card <n-card
v-if="evaluation.suggestions" v-if="suggestionLines.length"
size="small" size="small"
title="改进建议" title="改进建议"
style="margin-bottom: 16px" style="margin-bottom: 16px"
> >
<n-text>{{ evaluation.suggestions }}</n-text> <n-flex vertical :size="6">
<n-text
v-for="(suggestion, index) in suggestionLines"
:key="`${index}-${suggestion}`"
>
{{ suggestion }}
</n-text>
</n-flex>
</n-card> </n-card>
<!-- 详细评分 --> <!-- 详细评分 -->

View File

@@ -43,24 +43,19 @@
<!-- 改进建议 --> <!-- 改进建议 -->
<n-card <n-card
v-if="suggestionItems.length" v-if="suggestionLines.length"
size="small" size="small"
title="改进建议" title="改进建议"
style="margin-bottom: 16px" style="margin-bottom: 16px"
> >
<div class="suggestion-list"> <n-flex vertical :size="6">
<div <n-text
v-for="(item, index) in suggestionItems" v-for="(suggestion, index) in suggestionLines"
:key="`${index}-${item.text}`" :key="`${index}-${suggestion}`"
class="suggestion-item"
:class="{ 'suggestion-item--important': item.important }"
> >
<n-tag v-if="item.important" type="warning" size="small"> {{ suggestion }}
重点 </n-text>
</n-tag> </n-flex>
<n-text>{{ item.text }}</n-text>
</div>
</div>
</n-card> </n-card>
<!-- 详细评分 --> <!-- 详细评分 -->
@@ -120,30 +115,18 @@ const submission = ref<FlowchartSubmission | null>(null)
const loading = ref(false) const loading = ref(false)
const rendering = ref(false) const rendering = ref(false)
const showLargeImage = ref(false) const showLargeImage = ref(false)
const suggestionLines = computed(() =>
splitSuggestionLines(submission.value?.ai_suggestions),
)
const suggestionItems = computed(() => { function splitSuggestionLines(suggestions?: string | null) {
const suggestions = submission.value?.ai_suggestions ?? ""
return suggestions return suggestions
.split(/\r?\n/) ? suggestions
.flatMap((line) => line.split(/(?=【重点】)/)) .split("\n")
.map((raw) => raw.trim()) .map((suggestion) => suggestion.trim())
.filter(Boolean) .filter(Boolean)
.map((raw) => { : []
const textWithoutBullet = raw }
.replace(/^(?:[-*]\s*|\d+[.)、]\s*)/, "")
.trim()
const important = textWithoutBullet.startsWith("【重点】")
const text = important
? textWithoutBullet.replace(/^【重点】\s*/, "").trim()
: textWithoutBullet
return {
important,
text: text || textWithoutBullet,
}
})
})
function getPercentType(percent: number) { function getPercentType(percent: number) {
if (percent >= 0.8) return "primary" if (percent >= 0.8) return "primary"
@@ -199,25 +182,4 @@ watch(() => props.submissionId, loadSubmission, { immediate: true })
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.suggestion-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.suggestion-item {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 8px 10px;
border-radius: 6px;
background: var(--n-color);
line-height: 1.6;
}
.suggestion-item--important {
border: 1px solid var(--n-warning-color);
background: var(--n-warning-color-suppl);
}
</style> </style>