goblin-agents 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/llm/aiAgent.js +22 -4
- package/package.json +1 -1
package/lib/llm/aiAgent.js
CHANGED
|
@@ -596,15 +596,33 @@ class AiAgent extends Elf {
|
|
|
596
596
|
|
|
597
597
|
/**
|
|
598
598
|
* Set chat session context, model and level of reasoning
|
|
599
|
-
* @param {
|
|
600
|
-
* @param {string} context
|
|
601
|
-
* @param {string} model
|
|
602
|
-
* @param {string} reasoning
|
|
599
|
+
* @param {string} contextId
|
|
600
|
+
* @param {string} [context]
|
|
601
|
+
* @param {string} [model]
|
|
602
|
+
* @param {string|boolean} [reasoning]
|
|
603
603
|
*/
|
|
604
604
|
async setContext(contextId, context, model, reasoning) {
|
|
605
605
|
this.logic.setContext(contextId, context, model, reasoning);
|
|
606
606
|
}
|
|
607
607
|
|
|
608
|
+
/**
|
|
609
|
+
* Retrieves the configuration associated with a chat context.
|
|
610
|
+
*
|
|
611
|
+
* Falls back to the global settings when no context-specific
|
|
612
|
+
* configuration is available.
|
|
613
|
+
*
|
|
614
|
+
* @param {string} contextId - Unique identifier of the chat context.
|
|
615
|
+
* @returns {Promise<{context: string, model: string, reasoning: string|boolean}>}
|
|
616
|
+
* The context content, selected model, and reasoning level.
|
|
617
|
+
*/
|
|
618
|
+
async getContext(contextId) {
|
|
619
|
+
const context = this.state.contexts[contextId] || '';
|
|
620
|
+
const model = this.state.models[contextId] || this.state.model;
|
|
621
|
+
const reasoning =
|
|
622
|
+
this.state.reasonings[contextId] || this.state.reasoning || false;
|
|
623
|
+
return {context, model, reasoning};
|
|
624
|
+
}
|
|
625
|
+
|
|
608
626
|
async chat(contextId, question, userDesktopId) {
|
|
609
627
|
const logger = Logger.get(contextId, this);
|
|
610
628
|
|