feat(roundtable): 第一步识别出的意图支持手动编辑并保存
「当前意图摘要」卡新增编辑态:核心目标(必填)、约束、关键假设(可增删列表), 保存后由 useStep1Intent.updateIntentReady 覆盖权威 intentReady,下游(Step 2 种子消息 buildInitialIntent、侧栏摘要卡、step2Locked)随之生效,并落草稿持久化。 持久化用「计数 + effect」触发 handleManualSave,避免 enqueueSave 闭包在 setState flush 前读到旧意图的竞态(与 step2/step3 计数触发器同构)。聊天气泡内的绿色意图卡 保持为历史记录,右侧「当前意图摘要」为可编辑的当前值。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c230f7a6c6
commit
cc5ada1f3d
2 files changed
+231
-16
No files matched your search
@@ -123,6 +123,12 @@ export interface UseStep1IntentReturn {
|
||||
clarifications: ClarificationPayload[],
|
||||
overrideByKey?: Record<string, IntentClarificationSelection>,
|
||||
) => void;
|
||||
/**
|
||||
* 用户在「当前意图摘要」卡里手动编辑后保存:直接覆盖 `intentReady`。下游(Step 2 seed
|
||||
* `buildInitialIntent`、左右侧栏摘要卡、step2Locked 判定)都读 `intentReady`,改这里即全局生效。
|
||||
* 持久化由调用方(页面)在更新后触发草稿保存。
|
||||
*/
|
||||
updateIntentReady: (next: IntentSummary) => void;
|
||||
/** Abort 当前 intent 流。气泡尾部追加「(已暂停)」并 toast。 */
|
||||
stopIntentStream: () => void;
|
||||
/** 从草稿加载:批量 setState + 标记 init 已完成,跳过自动 runStep1Init。 */
|
||||
@@ -568,6 +574,12 @@ export function useStep1Intent(options: UseStep1IntentOptions): UseStep1IntentRe
|
||||
setInteractiveMessages((prev) => [...prev, msg]);
|
||||
}, []);
|
||||
|
||||
const updateIntentReady = useCallback((next: IntentSummary) => {
|
||||
// 用户手动改完意图 → 覆盖为权威值,并清掉「待澄清」态(已确认意图,无需再答问)。
|
||||
setIntentReady(next);
|
||||
setPendingIntentClarificationMsgId(null);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
intentThreadId,
|
||||
intentReady,
|
||||
@@ -582,6 +594,7 @@ export function useStep1Intent(options: UseStep1IntentOptions): UseStep1IntentRe
|
||||
runStep1Init,
|
||||
sendIntentMessage,
|
||||
submitIntentClarifications,
|
||||
updateIntentReady,
|
||||
stopIntentStream,
|
||||
hydrateFromDraft,
|
||||
appendLocalMessage,
|
||||
|
||||
Reference in new issue
Block a user