mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-22 00:00:27 +00:00
Release v0.23.2
Fixed Claude models via GitHub Copilot re-answering all previous prompts. fixes #209
This commit is contained in:
parent
b5c3d77219
commit
4894fa411c
18 changed files with 268 additions and 198 deletions
|
|
@ -310,13 +310,11 @@ function createClient(model: Model<"openai-responses">, context: Context, apiKey
|
|||
const headers = { ...model.headers };
|
||||
if (model.provider === "github-copilot") {
|
||||
// Copilot expects X-Initiator to indicate whether the request is user-initiated
|
||||
// or agent-initiated (e.g. follow-up after assistant/tool messages). If there is
|
||||
// no prior message, default to user-initiated.
|
||||
// or agent-initiated. It's an agent call if ANY message in history has assistant/tool role.
|
||||
const messages = context.messages || [];
|
||||
const lastMessage = messages[messages.length - 1];
|
||||
const isAgentCall = lastMessage ? lastMessage.role !== "user" : false;
|
||||
const initiatorValue = isAgentCall ? "agent" : "user";
|
||||
headers["X-Initiator"] = initiatorValue;
|
||||
const isAgentCall = messages.some((msg) => msg.role === "assistant" || msg.role === "toolResult");
|
||||
headers["X-Initiator"] = isAgentCall ? "agent" : "user";
|
||||
headers["Openai-Intent"] = "conversation-edits";
|
||||
}
|
||||
|
||||
return new OpenAI({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue