fix(core): rebuild system prompt after provider switch
setProvider() updated the resolved provider and model but did not rebuild the system prompt, so the runtime info line still showed the old provider/model (e.g. claude-code/claude-opus-4-6) after switching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0135951ac6
commit
afe51d325d
1 changed files with 8 additions and 0 deletions
|
|
@ -905,6 +905,14 @@ export class Agent {
|
|||
contextWindowTokens: this.contextWindowGuard.tokens,
|
||||
});
|
||||
|
||||
// Rebuild system prompt so runtime info reflects the new provider/model
|
||||
const toolNames = (this.agent.state.tools ?? []).map((t: { name: string }) => t.name);
|
||||
const systemPrompt = this.rebuildSystemPrompt(toolNames);
|
||||
if (systemPrompt) {
|
||||
this.agent.setSystemPrompt(systemPrompt);
|
||||
this.session.setSystemPrompt(systemPrompt);
|
||||
}
|
||||
|
||||
return {
|
||||
provider: providerId,
|
||||
model: model.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue