fable
This commit is contained in:
@@ -99,6 +99,15 @@ class GeminiProvider {
|
||||
|
||||
setPrompt(prompt) {
|
||||
this.config.prompt = prompt;
|
||||
// The live session carries the prompt as its first history entry —
|
||||
// update it in place so prompt changes (memory refresh, personality
|
||||
// swaps) apply without restarting the session
|
||||
try {
|
||||
const history = this.session?.params?.history;
|
||||
if (history && history[0] && history[0].role === 'user') {
|
||||
history[0].parts = [{ text: prompt }];
|
||||
}
|
||||
} catch (e) { /* session not started yet */ }
|
||||
}
|
||||
|
||||
getResponse(result) {
|
||||
|
||||
@@ -138,6 +138,13 @@ class OllamaProvider {
|
||||
content: rawContent
|
||||
});
|
||||
|
||||
// Cap history — unbounded growth eventually overflows num_ctx,
|
||||
// which silently truncates the system prompt (memories, tool docs)
|
||||
const maxHistory = this.config.maxHistory || 30;
|
||||
if (this.messages.length > maxHistory) {
|
||||
this.messages.splice(0, this.messages.length - maxHistory);
|
||||
}
|
||||
|
||||
// The text() closure strips markdown code fences so consumers
|
||||
// (processResponse, getToolCalls) get clean content.
|
||||
const result = {
|
||||
|
||||
Reference in New Issue
Block a user