feat: minor changes

This commit is contained in:
Mohamed Marrouchi 2024-10-21 11:40:22 +01:00
parent 648912fcc7
commit 8ef7e2abef
3 changed files with 26 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{ {
"name": "hexabot-ollama", "name": "hexabot-helper-ollama",
"version": "2.0.0", "version": "2.0.0",
"description": "The Ollama Helper Extension for Hexabot Chatbot / Agent Builder to enable the LLM Capability", "description": "The Ollama Helper Extension for Hexabot Chatbot / Agent Builder to enable the LLM Capability",
"dependencies": { "dependencies": {
@ -7,4 +7,4 @@
}, },
"author": "Hexastack", "author": "Hexastack",
"license": "AGPL-3.0-only" "license": "AGPL-3.0-only"
} }

View File

@ -16,7 +16,7 @@ export const OLLAMA_HELPER_SETTINGS = [
label: 'model', label: 'model',
group: OLLAMA_HELPER_GROUP, group: OLLAMA_HELPER_GROUP,
type: SettingType.text, type: SettingType.text,
value: 'tinyllama', // Default model value: 'llama3.2', // Default model
}, },
{ {
label: 'keep_alive', label: 'keep_alive',

View File

@ -67,6 +67,29 @@ export class HelperService {
return Array.from(helpers.values()); return Array.from(helpers.values());
} }
/**
* Get a helper by class.
*
* @param type - The type of helper.
* @param name - The helper's name.
*
* @returns - The helper
*/
public use<
T extends HelperType,
C extends new (...args: any[]) => TypeOfHelper<T>,
>(type: T, cls: C) {
const helpers = this.getAllByType(type);
const helper = helpers.find((h) => h instanceof cls);
if (!helper) {
throw new Error(`Unable to find the requested helper`);
}
return helper as InstanceType<C>;
}
/** /**
* Get default NLU helper. * Get default NLU helper.
* *