Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
在当前 Codeg 中,Antigravity 和 Pi Select 渠道通过 ACP 原生权限(
session/request_permission)桥接会话提问交互。optionId枚举,底层运行时(如 Antigravity 内部的localharness和agy_acp_server)会将传入的option_id转换为预设索引,无法承载自由文本。AskQuestionCard始终无差别渲染“其他”(Other)选项和输入框。antigravity_option_id无法匹配任何预设选项,Codeg 只能以RequestPermissionOutcome::Cancelled回应权限请求。Cancelled后直接视为用户放弃/未回复(unanswered=True),导致用户辛辛苦苦输入的文字被静默吞掉、当成交互取消。改动
采用方案 A(标准协议与渲染解耦):在
QuestionSpec中增加allow_other标识,仅允许支持自由文本的渠道显示“其他”,避免误导用户。后端数据结构与解析适配(Rust /
src-tauri):QuestionSpec中增加allow_other: bool字段,通过#[serde(default = "default_true")]默认向后兼容为true。parse_antigravity_ask与parse_pi_select_ask中,明确标记allow_other: false。parse_questions、parse_grok_ext_questions、parse_form_questions、parse_cursor_ask_questions)中保持allow_other: true。grok_result_card_input中透传"allowOther": s.allow_other,确保历史消息与实时提问卡片表现一致。前端卡片渲染与类型适配(TypeScript / React /
src):QuestionSpec(src/lib/types.ts) 中补充allow_other?: boolean;在AskQuestion(src/lib/ask-question.ts) 中补充allowOther?: boolean并进行容错解析。AskQuestionCard(src/components/chat/ask-question-card.tsx) 中:q.allow_other === false时,隐藏 RadioGroup 中的“其他”条目及输入框。q.allow_other === false时,隐藏 Checkbox 中的“其他”条目及输入框。maxRows动态根据allow_other状态计算,避免隐藏“其他”后留出多余空白。AskQuestionResultCard中透传allow_other字段。双端自动化测试:
src/components/chat/ask-question-card.test.tsx:新增单选和多选下allow_other: false时隐藏“其他”选项及输入框的断言,全量 33 个用例全部 PASS。src/lib/ask-question.test.ts:兼容缺失与显式标记,57 个用例全部 PASS。question.rs):增加parse_antigravity_ask和parse_pi_select_ask的allow_other == false断言,以及标准解析下的allow_other == true断言。界面与效果展示
1. Antigravity 提问卡片(
allow_other: false)optionId。2. 标准问答与 Codex 卡片(
allow_other: true)测试
git diff --check:无格式与空白冲突。pnpm test src/components/chat/ask-question-card.test.tsx(33 tests) 与src/lib/ask-question.test.ts(57 tests) 全部 PASS。pnpm tsc --noEmit0 错误。pnpm build37/37 个静态页面全量导出成功。cargo check --bin codeg成功(0 error)。cargo check --no-default-features --features server-bin --bin codeg-server成功。cargo check --no-default-features --features mcp-bin --bin codeg-mcp成功。