Repository navigation
fix(relaykit): 保留 Gemini 工具调用旁的文本 (#149) - #158
Merged
Merged
Conversation
Port upstream 0165fef (QuantumNous#7998). Co-authored-by: Xudong Zhang <[email protected]>
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.
🔗 关联任务 / Related Issue
Closes #149
上游:0165fef98d41b02a7368e89dc5fa2df651f8587b(QuantumNous#7998)。
🚀 变更类型 / Type of change
📝 变更描述 / Description
Gemini model 消息同时包含文本与 functionCall 时,转换为 OpenAI Chat 会丢失文本。独立设置 content 和 tool_calls,使两者同时保留。仅移植指定上游补丁的两个文件,保留 fork 现有转换逻辑;稳定 patch-id 与上游一致。
本次移植、验证和说明由 Codex AI 辅助完成;提交代理对所列验证记录的准确性负责,人工确认及独立审查待维护者完成。已核对 git 身份 woncc 与历史主要贡献者一致。
📸 运行证明 / Proof of Work
以下 Go 命令均在 relaykit/ 内执行:
GOMAXPROCS=2 RAYON_NUM_THREADS=2 GOWORK=off go test -p=2 ./relayconvert/ -run '^TestGeminiToOpenAIChatPreservesTextAlongsideToolCalls$' -count=1,退出 1;text_and_call 与 text_around_call 分别丢失 1、2 段文本。GOMAXPROCS=2 RAYON_NUM_THREADS=2 GOWORK=off go test -p=2 ./relayconvert/ ./relayconvert/internal/gemini_chat/ -count=1,退出 0;relayconvert 通过,gemini_chat 无独立测试文件。回归检查序列化后的文本、角色、工具 ID、函数名与参数,同时覆盖纯文本和纯调用。GOMAXPROCS=2 RAYON_NUM_THREADS=2 GOWORK=off go build -p=2 ./...,退出 0,独立模块构建成功。git diff --check通过。未进行真实供应商请求、全仓测试或部署;不涉及数据库、计费字段、认证、前端或依赖更新。✅ 提交前检查项 / Checklist