diff --git a/Caddyfile b/Caddyfile index 9fc5739..89e2f67 100644 --- a/Caddyfile +++ b/Caddyfile @@ -8,6 +8,14 @@ } handle_path /media/* { + # 上传的 html/svg 直接打开时不能当成本站页面跑脚本(会读到 localStorage 里的 token); + # 作为图片、样式、脚本引用时不受 sandbox 影响。预览 iframe 没有 allow-same-origin, + # 读字体或 fetch() 素材要跨域许可 + header { + Content-Security-Policy "sandbox" + X-Content-Type-Options "nosniff" + Access-Control-Allow-Origin "*" + } root * /media file_server } diff --git a/client/src/components/ai/PromptPanel.vue b/client/src/components/ai/PromptPanel.vue index 237b43d..a6de48e 100644 --- a/client/src/components/ai/PromptPanel.vue +++ b/client/src/components/ai/PromptPanel.vue @@ -150,6 +150,10 @@ const modelOptions = [ { label: "DeepSeek", value: "deepseek-flash" }, ] const selectedModel = useStorage("prompt-model", "deepseek-flash") +// 浏览器里可能还存着改版前的模型名 +if (!modelOptions.some((o) => o.value === selectedModel.value)) { + selectedModel.value = "deepseek-flash" +} // Group messages into user+assistant pairs const submittingId = ref(null) diff --git a/client/src/components/ai/RandomRatingModal.vue b/client/src/components/ai/RandomRatingModal.vue index f10a1be..7db8298 100644 --- a/client/src/components/ai/RandomRatingModal.vue +++ b/client/src/components/ai/RandomRatingModal.vue @@ -65,6 +65,8 @@ function clearReshowTimer() { async function fetchAndShow() { try { const item = await Submission.randomForRating(current.value?.submission_id) + // 请求期间 AI 已经回复完了,就不要再弹出来 + if (!streaming.value) return if (item) { current.value = item previewContent.value = buildPreviewDocument({ diff --git a/client/src/components/task/TaskPanel.vue b/client/src/components/task/TaskPanel.vue index 142b4f5..ca9adce 100644 --- a/client/src/components/task/TaskPanel.vue +++ b/client/src/components/task/TaskPanel.vue @@ -170,7 +170,11 @@ function syncRoute(routeName: string) { } } syncRoute(route.name as string) -watch(() => route.name as string, syncRoute) +// 只换了 display(比如浏览器后退到上一节教程)也要同步 +watch( + () => [route.name as string, route.params.display] as const, + ([name]) => syncRoute(name), +) defineEmits(["hide"]) diff --git a/client/src/components/task/TutorialContent.vue b/client/src/components/task/TutorialContent.vue index 68a45b4..d181393 100644 --- a/client/src/components/task/TutorialContent.vue +++ b/client/src/components/task/TutorialContent.vue @@ -3,7 +3,8 @@