Copilot SSE streaming endpoint API specification#2922
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Code Review
This pull request is a significant and well-executed migration of the main copilot's tool-use mechanism from a custom XML format to the provider's standard tool-call API. The changes span across documentation, OpenAPI specifications, and frontend logic, including a new SSE-based streaming implementation. The implementation is robust, with thorough handling of backward compatibility for persisted sessions and a comprehensive new test suite. My review found one area for improvement in the OpenAPI specification to reduce duplication.
|
|
||
| The response is a Server-Sent Events (SSE) stream where each `data:` line contains a single JSON object. | ||
|
|
||
| #### Event semantics |
There was a problem hiding this comment.
这里的定义与 OpenAI-compatible API 概念一致,不过有细微的区别,如
- 结构上更简单,没有 choices 等我们不需要的概念
- 数据字段名与其他接口数据命名风格保持一致为小驼峰
There was a problem hiding this comment.
Pull request overview
Updates the Copilot API spec to support provider-standard tool calling and introduces a structured SSE streaming endpoint to improve tool-call reliability and client parsing.
Changes:
- Replaces inline Copilot message request bodies with a shared
CopilotMessageRequestschema. - Redefines
CopilotMessageas a discriminated union (user/copilot/tool) with structuredtoolCallsand tool-result messages. - Adds
POST /copilot/sse/messagewith defined SSE event semantics and schemas for structured streaming.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The schema refactoring is well-structured overall — the discriminated |
Update #2901