Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
enhancement: Add custom Jinja chat template option
Akarshanffef7b9cab51
diff --git a/extensions/llamacpp-extension/settings.json b/extensions/llamacpp-extension/settings.jsonindex 707b50c00..8d013fee1 100644--- a/extensions/llamacpp-extension/settings.json+++ b/extensions/llamacpp-extension/settings.json@@ -23,6 +23,18 @@"controllerType": "checkbox","controllerProps": { "value": true }},+ {+ "key": "chat_template",+ "title": "Custom Jinja Chat template",+ "description": "Custom Jinja chat_template to be used for the model",+ "controllerType": "input",+ "controllerProps": {+ "value": "",+ "placeholder": "e.g., {% for message in messages %}...{% endfor %} (default is read from GGUF)",+ "type": "text",+ "textAlign": "right"+ }+ },{"key": "threads","title": "Threads",diff --git a/extensions/llamacpp-extension/src/index.ts b/extensions/llamacpp-extension/src/index.tsindex e68812510..878c6f4f6 100644--- a/extensions/llamacpp-extension/src/index.ts+++ b/extensions/llamacpp-extension/src/index.ts@@ -33,6 +33,7 @@ type LlamacppConfig = {version_backend: stringauto_update_engine: booleanauto_unload: boolean+ chat_template: stringn_gpu_layers: numberctx_size: numberthreads: number@@ -793,6 +794,7 @@ export default class llamacpp_extension extends AIEngine {}// Add remaining options from the interface+ if (cfg.chat_template) args.push('--chat-template', cfg.chat_template)args.push('-ngl', String(cfg.n_gpu_layers > 0 ? cfg.n_gpu_layers : 100))if (cfg.threads > 0) args.push('--threads', String(cfg.threads))if (cfg.threads_batch > 0)