feat: “出问题了”三栏说清问题,交作品时写一句反思,外部提示词至少 8 个字
Deploy / deploy (build, debian, 22) (push) Canceled after 0s
Deploy / deploy (build, debian, 22) (push) Canceled after 0s
- 对话框加“出问题了”:做了什么 / 想看到什么 / 实际看到了什么拼成一句发给 AI; 只说“还是不行”这类的提醒一次,可以直接发 - “交这一版”先弹框问最满意的改动和理由(可以不写),存在 submission_reflection, 批改面板显示为“学生说”,只有老师和作者本人看得到 - 粘贴外部 AI 代码时提示词至少 8 个字,可以把几轮都贴进来 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5bdacc438d
commit
e9127318cb
12 files changed
+351
-63
No files matched your search
@@ -103,6 +103,12 @@
|
||||
</template>
|
||||
</n-split>
|
||||
<PasteCodeModal v-model:show="showPaste" :on-save="savePasted" />
|
||||
<SubmitModal
|
||||
v-model:show="showSubmit"
|
||||
:title="submitTitle"
|
||||
:has-earlier="submitHasEarlier"
|
||||
:on-submit="submitChallenge"
|
||||
/>
|
||||
<n-drawer v-model:show="showHistory" :width="420" placement="right">
|
||||
<n-drawer-content title="全部历史" :native-scrollbar="false" body-content-style="padding: 0">
|
||||
<PromptHistoryPanel
|
||||
@@ -128,6 +134,7 @@ import Preview from "../editor/Preview.vue"
|
||||
import CodeTabs from "./CodeTabs.vue"
|
||||
import VersionBar, { type VersionItem } from "./VersionBar.vue"
|
||||
import PasteCodeModal from "./PasteCodeModal.vue"
|
||||
import SubmitModal from "./SubmitModal.vue"
|
||||
import { Prompt, Submission } from "../../api"
|
||||
import { useTaskCode } from "../../composables/useTaskCode"
|
||||
import {
|
||||
@@ -174,6 +181,7 @@ const selectedId = ref<number | null>(null)
|
||||
const busy = ref(false)
|
||||
const briefOpen = ref(true)
|
||||
const showPaste = ref(false)
|
||||
const showSubmit = ref(false)
|
||||
const showHistory = ref(false)
|
||||
const historyKey = ref(0)
|
||||
|
||||
@@ -308,21 +316,46 @@ function openHistory() {
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (props.kind === "challenge") {
|
||||
showSubmit.value = true
|
||||
return
|
||||
}
|
||||
busy.value = true
|
||||
try {
|
||||
await props.saveWork?.({ ...code })
|
||||
message.success("作品已保存")
|
||||
} catch (err: any) {
|
||||
message.error(err.response?.data?.detail ?? "保存失败,请重试")
|
||||
} finally {
|
||||
busy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitTitle = computed(() => {
|
||||
if (modified.value || !selectedId.value) return "交当前修改"
|
||||
const n = versions.value.find((v) => v.id === selectedId.value)?.n
|
||||
return n ? `交 v${n}` : "交这一版"
|
||||
})
|
||||
|
||||
// 要交的这一版之前还有版本(当前修改会存成新的一版)
|
||||
const submitHasEarlier = computed(() => {
|
||||
if (modified.value || !selectedId.value) return versions.value.length > 0
|
||||
return (versions.value.find((v) => v.id === selectedId.value)?.n ?? 1) > 1
|
||||
})
|
||||
|
||||
// 挑战:先在弹框里写一句反思(可以不写)再交;出错时抛出去,弹框不关
|
||||
async function submitChallenge(reflection: string) {
|
||||
busy.value = true
|
||||
try {
|
||||
if (props.kind === "creation") {
|
||||
await props.saveWork?.({ ...code })
|
||||
message.success("作品已保存")
|
||||
return
|
||||
}
|
||||
const id =
|
||||
modified.value || !selectedId.value ? await saveAsVersion() : selectedId.value
|
||||
await Submission.create(props.taskId, { ...code }, id)
|
||||
await Submission.create(props.taskId, { ...code }, id, reflection)
|
||||
markMessageSubmitted(id)
|
||||
const n = versions.value.find((v) => v.id === id)?.n
|
||||
message.success(n ? `已提交 v${n}` : "已提交")
|
||||
} catch (err: any) {
|
||||
message.error(err.response?.data?.detail ?? "提交失败,请重试")
|
||||
throw err
|
||||
} finally {
|
||||
busy.value = false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user