mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-21 05:42:01 +00:00
Excel 导入改造期 3:网格交互、自助修复、按期累积——每月的报表可以累积成一份跨月的表,漂移了点修复按钮就能接着导入,网格上框一块就能写进配方,版本页可以回滚、移除一期、清除原件
按期累积(新 recipe_accumulate;table_versions 扩展) - 按统计期出的交叉表报表首次导入时默认「按期累积」,由人确认;一期一个构建,两期及以上物化成一份新的 SQLite 快照,不用视图 - 统计期完全相同要勾「替换该期」,部分重叠拒收,中间有空缺要确认;物化前逐期核对库哈希和行号,并集上另加行数守恒、主键唯一、日期落在所属统计期三条核对 - 配方演进分三档:新增列(早期各期为空值)、退役的列和表保留旧值(只在这次才退役时要勾)、不兼容变化只能显式「重新开始累积」 - 快照 id 在累积时含目标配方和模式;同样的输入物化两次库哈希相同,同一文件换名再传直接复用 - 说明按期合并,任何一期没核对过就不写「已核对」;各期维度取值不同、退役列、合计表都有提示,经过数字检查 修复按钮(新 recipe_fixes;执行器给问题带结构化参数) - 加入标签、移除标签、声明为合计行、分段标题改名、编辑恒等式成员、按锚点忽略行/列/区域外文字、声明占位符、声明隐藏行处理、工作表改名 - 服务端算补丁,先预览新旧配方对照、再应用,可以撤销;补丁封闭,不引入正则、自由文本常量和写死坐标;修复进确认清单 - 只改分段标题、新标题仍含原来选的词时沿用已确认的常量,不算破坏性变更;修复后只查改动过的段的认领,没改的关系交给试运行核对 框选转锚点(新 recipe_select) - 网格上框选(鼠标、键盘、区域输入),按八种用途换算成按文字认的锚点,立刻干跑比对;配方里不存坐标,泛化不了时列出原因 - 整张表挪位后同一配方照样认得;框进合计行、夹着小计、表下说明都有明确的处理 确认与对照(recipe_confirm、recipe_diff、新 recipe_compare) - 改配方后确认清单只列有变化的项(同时按本期数据比较),不用每修一次重勾十来项;新旧配方对照界面;按规则重新起草并把名字对齐到现行配方 - 改配方后已体现在配方里的回答保留,矛盾的列出来请人重答 - 「排除的行」写进回执和导入清单:隐藏行、跳过的空行、按配方忽略的行、停止后的文字行、只核对不另存的合计行 版本页(新 source_versions、api/source_versions;前端 VersionsDialog) - 快照与导入记录列表、启用旧版本(可写理由)、查看清单、移除一期、作废接受、清除原件;写操作带界面看到的当前版本,并发改动回 409,不静默丢期 - 除当前版本和被运行引用的版本外,再保留最近 3 个版本供回滚;遮罩列丢失要明确确认 期 1、期 2 遗留 - 重传撞上被改过的构建文件:能用本次上传恢复就隔离旧文件再恢复,否则回 409,不再是 500 - 跳过空行的列表不再把表下隔一行的说明读成数据;不像说明的单格行要人确认;受影响的配方构建换 id - 版本存储加进程级文件锁:第二个进程拿不到锁时不清理、不回收,写操作回 503(部署本来就是单进程)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type {
|
||||
AiPreview, CommitOut, CurrentRecipe, QuestionAnswer, Recipe, Staging,
|
||||
ActivateSnapshotBody, ActivateSnapshotOut, AiPreview, CommitOut, CurrentRecipe, EditPreview, EditRequest, ImportRecord,
|
||||
ManifestOut, PurgeRawBody, PurgeRawOut, QuestionAnswer, Recipe, RedraftRulesOut, RemovePeriodBody, RemovePeriodOut,
|
||||
RevokeAcceptanceBody, RevokeAcceptanceOut, SnapshotOut, Staging,
|
||||
} from '../types'
|
||||
import type {
|
||||
Approval, AutofixResult, Conversation, ConversationDetail, ConversationTurn, CustomTool, DataSource, EvidenceGraph,
|
||||
@@ -572,9 +574,13 @@ export const api = {
|
||||
/** 已选的全部回答(服务端从起点配方按问题顺序重放)。needs_reason 的选项要带 reason */
|
||||
answers: (id: string, answers: Record<string, QuestionAnswer>) =>
|
||||
post<Staging>(`/datasources/imports/${encodeURIComponent(id)}/answers`, { answers }),
|
||||
/** 整份配方替换工作配方:有静态校验问题也照存,只是不能试运行;已选的回答清空 */
|
||||
putRecipe: (id: string, recipe: Recipe) =>
|
||||
put<Staging>(`/datasources/imports/${encodeURIComponent(id)}/recipe`, { recipe }),
|
||||
/**
|
||||
* 整份配方替换工作配方:有静态校验问题也照存,只是不能试运行。期 3:仍然成立的回答保留(不成立的进
|
||||
* answers_dropped),撤销栈清空、之前的修改标「已被覆盖」。origin 只在采用「按规则重新起草」的结果时给
|
||||
* 'rules_redraft'(服务端核对配方哈希,对不上回 409 redraft_mismatch);不给时请求体与期 2 相同
|
||||
*/
|
||||
putRecipe: (id: string, recipe: Recipe, origin?: 'rules_redraft') =>
|
||||
put<Staging>(`/datasources/imports/${encodeURIComponent(id)}/recipe`, origin ? { recipe, origin } : { recipe }),
|
||||
/** 将要发给模型的全文(同意框里给人看的就是这一份) */
|
||||
draftAiPreview: (id: string) => get<AiPreview>(`/datasources/imports/${encodeURIComponent(id)}/draft-ai/preview`),
|
||||
/** 用户同意后才调:preview_sha256 与服务端重算的不一致时回 409 ai_preview_stale */
|
||||
@@ -595,6 +601,52 @@ export const api = {
|
||||
/** 修改配方(不换文件):用当前导入的原件、以当前配方为工作配方 */
|
||||
redraft: (sourceId: string) => post<Staging>(`/datasources/${encodeURIComponent(sourceId)}/redraft`, {}),
|
||||
recipe: (sourceId: string) => get<CurrentRecipe>(`/datasources/${encodeURIComponent(sourceId)}/recipe`),
|
||||
/**
|
||||
* 期 3:修复或框选的预览(不改工作配方)。body 是 {fix: {id, option, reason?}} 或 {selection: {sheet, ref, as,
|
||||
* options?}} 二选一,seq 原样回传(只采用最新一次的回包)。ok=false 时照样 200,原因在 problems
|
||||
*/
|
||||
editPreview: (id: string, body: EditRequest) =>
|
||||
post<EditPreview>(`/datasources/imports/${encodeURIComponent(id)}/edits/preview`, body),
|
||||
/**
|
||||
* 期 3:应用预览过的修复或框选。选项和理由必须与预览时逐字相同,expected_sha256 是预览返回的
|
||||
* recipe_sha256_after:对不上回 409 edit_stale(需要重新预览);提议已不在当前列表里回 409 fix_stale
|
||||
*/
|
||||
editApply: (id: string, body: EditRequest & { expected_sha256: string; signed_by?: string | null }) =>
|
||||
post<Staging>(`/datasources/imports/${encodeURIComponent(id)}/edits/apply`, body),
|
||||
/** 期 3:撤销上一次修改。没有可撤销的回 409 nothing_to_undo;之后配方又被改过回 409 undo_stale */
|
||||
editUndo: (id: string) => post<Staging>(`/datasources/imports/${encodeURIComponent(id)}/edits/undo`, {}),
|
||||
/** 期 3:按规则重新起草(不调用模型、不改工作配方),名字对齐到现行配方;「采用」走 putRecipe(…, 'rules_redraft') */
|
||||
redraftRules: (id: string) =>
|
||||
post<RedraftRulesOut>(`/datasources/imports/${encodeURIComponent(id)}/redraft-rules`, {}),
|
||||
},
|
||||
|
||||
/**
|
||||
* 期 3 的版本页(数据源卡片上的「版本」,P3-SPEC 第 7 节):版本列表、启用旧版本、清单、移除一期、作废接受、
|
||||
* 导入记录与清除原件。写操作都要 confirm: true;启用、移除、作废还要带界面看到的当前版本 id
|
||||
* (expected_current_snapshot_id),别人在这期间改过当前版本时回 409 base_changed。错误按 ApiError.code 分支
|
||||
*/
|
||||
versions: {
|
||||
/** 最近 50 个版本,当前版本排第一。手工源返回空列表 */
|
||||
snapshots: (sourceId: string) => get<SnapshotOut[]>(`/datasources/${encodeURIComponent(sourceId)}/snapshots`),
|
||||
activate: (sourceId: string, snapshotId: string, body: ActivateSnapshotBody) =>
|
||||
post<ActivateSnapshotOut>(
|
||||
`/datasources/${encodeURIComponent(sourceId)}/snapshots/${encodeURIComponent(snapshotId)}/activate`, body),
|
||||
snapshotManifest: (sourceId: string, snapshotId: string) =>
|
||||
get<ManifestOut>(`/datasources/${encodeURIComponent(sourceId)}/snapshots/${encodeURIComponent(snapshotId)}/manifest`),
|
||||
importManifest: (sourceId: string, importId: string) =>
|
||||
get<ManifestOut>(`/datasources/${encodeURIComponent(sourceId)}/imports/${encodeURIComponent(importId)}/manifest`),
|
||||
/** 从当前版本中移除这一期(累积模式;配方和导入模式不变) */
|
||||
removePeriod: (sourceId: string, importId: string, body: RemovePeriodBody) =>
|
||||
post<RemovePeriodOut>(`/datasources/${encodeURIComponent(sourceId)}/imports/${encodeURIComponent(importId)}/remove`, body),
|
||||
/** 撤回这一期(作废接受,不可恢复):替换模式回滚到 revoke_plan 的目标,累积模式移除这一期 */
|
||||
revokeAcceptance: (sourceId: string, importId: string, body: RevokeAcceptanceBody) =>
|
||||
post<RevokeAcceptanceOut>(
|
||||
`/datasources/${encodeURIComponent(sourceId)}/imports/${encodeURIComponent(importId)}/revoke-acceptance`, body),
|
||||
/** 全部导入记录,新的在前(含已被替换的) */
|
||||
imports: (sourceId: string) => get<ImportRecord[]>(`/datasources/${encodeURIComponent(sourceId)}/imports`),
|
||||
/** 清除一次导入的原件(同一份内容的其他导入一并清除,引用它的未完成导入一并放弃)。理由必填 */
|
||||
purgeRaw: (sourceId: string, importId: string, body: PurgeRawBody) =>
|
||||
post<PurgeRawOut>(`/datasources/${encodeURIComponent(sourceId)}/imports/${encodeURIComponent(importId)}/purge-raw`, body),
|
||||
},
|
||||
|
||||
runs: {
|
||||
|
||||
Reference in New Issue
Block a user