File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ const USER_AGENT = `GitHubCopilotChat/${COPILOT_VERSION}`
1414const API_VERSION = "2025-10-01"
1515
1616export const copilotBaseUrl = ( state : State ) =>
17- `https://api.${ state . accountType } .githubcopilot.com`
18-
17+ state . accountType === "individual" ?
18+ "https://api.githubcopilot.com"
19+ : `https://api.${ state . accountType } .githubcopilot.com`
1920export const copilotHeaders = ( state : State , vision : boolean = false ) => {
2021 const headers : Record < string , string > = {
2122 Authorization : `Bearer ${ state . copilotToken } ` ,
Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ function handleContent(
218218 delta . content === ""
219219 && delta . reasoning_opaque
220220 && delta . reasoning_opaque . length > 0
221+ && state . thinkingBlockOpen
221222 ) {
222223 events . push (
223224 {
@@ -317,6 +318,15 @@ function handleThinkingText(
317318 events : Array < AnthropicStreamEventData > ,
318319) {
319320 if ( delta . reasoning_text && delta . reasoning_text . length > 0 ) {
321+ // compatible with copilot API returning content->reasoning_text->reasoning_opaque in different deltas
322+ // this is an extremely abnormal situation, probably a server-side bug
323+ // only occurs in the claude model, with a very low probability of occurrence
324+ if ( state . contentBlockOpen ) {
325+ delta . content = delta . reasoning_text
326+ delta . reasoning_text = undefined
327+ return
328+ }
329+
320330 if ( ! state . thinkingBlockOpen ) {
321331 events . push ( {
322332 type : "content_block_start" ,
You can’t perform that action at this time.
0 commit comments