fix: 按提示词生成 Description 并保留原文
Deploy production / deploy (push) Successful in 56s

取消生成和写回时的内容、label 与长度校验,避免正常模型文本被本地 500 字符上限拒绝。模型直接返回普通文本,用户可在 textarea 中编辑后原样写回。

验证:62 项后端相关测试、前端构建与浏览器生成编辑写回检查通过;使用用户提供的表达式和 Chat Completions 服务实测一次生成 686 字符成功。
This commit is contained in:
yuxuanhui
2026-09-10 16:07:18 +08:00
parent a39894a9f1
commit 49bf8de9c8
3 changed files with 127 additions and 252 deletions
+3 -21
View File
@@ -12,18 +12,6 @@ type Submission = {
can_check: boolean;
job: Job | null;
};
const validDescription = (text: string) => {
const paragraphs = text.match(
/^\s*Idea:\s*(.*?)\s*Rationale for data used:\s*(.*?)\s*Rationale for operators used:\s*(.*?)\s*$/s,
);
const length = Array.from(text).length;
return (
length >= 100 &&
length <= 500 &&
!!paragraphs &&
paragraphs.slice(1).every((part) => part.trim())
);
};
const activeStates = [
"queued",
"running",
@@ -113,14 +101,11 @@ export function SubmissionPanel({
return error ? <Banner type="danger" description={error} /> : <Spin />;
const running = !!data.job && activeStates.includes(data.job.status);
const conflict = snapshot !== data.snapshot;
const valid =
Object.keys(draft).length > 0 &&
Object.values(draft).every(validDescription);
return (
<div className="detail-section">
<h3>Description 与提交检查</h3>
<p className="muted">
AI 一次生成完整的三段内容,可在下方统一修改。写回并检查会更新 BRAIN 的
AI 一次生成完整 Description,可在下方统一修改。写回并检查会更新 BRAIN 的
Description,随后获取平台提交检查结果,不会正式提交 Alpha。
</p>
{error && <Banner type="danger" description={error} />}
@@ -174,7 +159,6 @@ export function SubmissionPanel({
aria-label={`${section} Description`}
value={value}
rows={7}
maxCount={500}
placeholder={
"Idea: 策略假设\n\nRationale for data used: 数据选择理由\n\nRationale for operators used: 算子使用理由"
}
@@ -186,9 +170,7 @@ export function SubmissionPanel({
/>
</label>
<p className="muted">
总长度:{Array.from(value).length} / 500 字符;至少 100
字符,包含标题与换行。 三个段落分别以 Idea:、Rationale for data
used:、Rationale for operators used: 开头。
总长度:{Array.from(value).length} 字符。可直接修改生成内容后写回。
</p>
</section>
))}
@@ -196,7 +178,7 @@ export function SubmissionPanel({
<Button
theme="solid"
loading={busy === "check"}
disabled={!!busy || running || conflict || !valid || !data.can_check}
disabled={!!busy || running || conflict || !data.can_check}
onClick={() => void check()}
>
写回 Description 并检查