Prhub

#2358 feat(session): serve Anthropic Messages through SessionCore

原始 PR 作者 guapisolo 合并时间 2026-08-30 09:34 文件变更 5 提交数 1 评论 0 代码增减 +1217 / -5

执行摘要

实现拆解

  1. 核心源码路径
    - miles/rollout/session/anthropic_adapter.py(dependency-wiring):源码主路径;涉及符号 _anthropic_wire_json, _anthropic_error_response, _anthropic_sse_body, _parse_anthropic_request;包含 导入关系调整、控制流调整、配置键调整;+130/-0;关键符号:_anthropic_wire_json, _anthropic_error_response, _anthropic_sse_body, _parse_anthropic_request
    - miles/rollout/session/sessions.py(dependency-wiring):源码主路径;涉及符号 anthropic_messages;包含 导入关系调整、控制流调整、配置键调整;+102/-3;关键符号:anthropic_messages
    - miles/utils/test_utils/mock_sglang_server.py(core-logic):源码主路径;包含 控制流调整、配置键调整;+11/-0

  2. 测试与验证
    - tests/fast/router/test_session_anthropic.py(test-coverage):测试配套;涉及符号 _process_fn, _anthropic_env, anthropic_env, anthropic_env_loose;包含 测试覆盖调整、导入关系调整、控制流调整;+965/-0;关键符号:_process_fn, _anthropic_env, anthropic_env, anthropic_env_loose
    - tests/fast/utils/test_utils/test_mock_sglang_server.py(test-coverage):测试配套;包含 测试覆盖调整、配置键调整;+9/-2

文件 模块 状态 重要度
miles/rollout/session/anthropic_adapter.py miles/rollout added 8.96
tests/fast/router/test_session_anthropic.py session/anthropic added 8.42
miles/rollout/session/sessions.py miles/rollout modified 7.62
miles/utils/test_utils/mock_sglang_server.py miles/utils modified 5.9
tests/fast/utils/test_utils/test_mock_sglang_server.py mock/sglang/server modified 4.5

关键符号

_anthropic_wire_json _anthropic_error_response _anthropic_sse_body _parse_anthropic_request _validate_anthropic_content_block _validate_anthropic_features _strip_anthropic_reasoning_history _restore_anthropic_reasoning_history _process_fn _anthropic_env

分析完成后,这里会展示 LLM 生成的相对完整源码片段和详细注释。

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论