From f510e7ac9536e6e4c30842f3b91383e04906d628 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 18:55:05 +0000 Subject: [PATCH] fix: apply CodeRabbit auto-fixes Fixed 2 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit --- open-sse/executors/github.js | 12 +++++++++++- open-sse/providers/registry/hcnsec.js | 13 ++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/open-sse/executors/github.js b/open-sse/executors/github.js index e998250..a9eac9b 100644 --- a/open-sse/executors/github.js +++ b/open-sse/executors/github.js @@ -39,6 +39,8 @@ export class GithubExecutor extends BaseExecutor { } buildUrl(model, stream, urlIndex = 0) { + const targetFormat = getModelTargetFormat("gh", model); + // Claude models: route to Copilot's Anthropic-native /v1/messages shim — the // only Copilot endpoint that surfaces prompt-cache token counts for Claude // and avoids a lossy round-trip of tool_use/tool_result/thinking content @@ -46,9 +48,17 @@ export class GithubExecutor extends BaseExecutor { // targetFormat (see registry/github.js), which chatCore also uses to // translate the request to Claude shape before the executor ever sees it. // Port of decolua/9router#2608. - if (getModelTargetFormat("gh", model) === "claude" && this.config.messagesUrl) { + if (targetFormat === "claude" && this.config.messagesUrl) { return this.config.messagesUrl; } + + // OpenAI Responses models: route to Copilot's /responses endpoint, which + // serves newer GPT models and provides the correct response format for + // models marked with targetFormat: "openai-responses" in the registry. + if (targetFormat === "openai-responses" && this.config.responsesUrl) { + return this.config.responsesUrl; + } + return this.config.baseUrl; } diff --git a/open-sse/providers/registry/hcnsec.js b/open-sse/providers/registry/hcnsec.js index 89d5ee0..acd749e 100644 --- a/open-sse/providers/registry/hcnsec.js +++ b/open-sse/providers/registry/hcnsec.js @@ -36,9 +36,16 @@ export default { scheme: "bearer", }, }, - // Live discovery only — /v1/models exposes whatever the key has access to. - // Empty seed catalog; passthroughModels allows any model id. - models: [], + // Seed catalog — offline fallback when live /v1/models fetch fails. + // Typical models available on HCNSEC platform (exact catalog varies by API key). + // Live discovery via modelsFetcher provides the real-time list. + models: [ + { id: "gpt-4o", name: "GPT-4o" }, + { id: "gpt-4o-mini", name: "GPT-4o Mini" }, + { id: "claude-sonnet-4.5", name: "Claude Sonnet 4.5" }, + { id: "deepseek-v3", name: "DeepSeek V3" }, + { id: "glm-5", name: "GLM 5" }, + ], passthroughModels: true, modelsFetcher: { url: "https://api.hcnsec.cn/v1/models",