From f65087d237937df95a487eae3c3404971113d53c Mon Sep 17 00:00:00 2001 From: Jason Schleifer Date: Sat, 25 Jan 2025 14:39:02 +1300 Subject: [PATCH 1/2] make sure ollama reads the settings properly --- js/settings.js | 103 +++++++++++++----------- nodes/drivers/gtUIOllamaPromptDriver.py | 2 + 2 files changed, 59 insertions(+), 46 deletions(-) diff --git a/js/settings.js b/js/settings.js index 845d343..3dc4168 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,54 +1,65 @@ import { keys_organized } from "./griptape_api_keys.js"; export function createSettings(app) { - // Create the settings - app.ui.settings.addSetting({ - id: `Griptape.default_config`, - category: ["Griptape", "!Griptape", "default_config"], - name: "default_config", - type: "dict", - defaultValue: "", - tooltip: "To set this, use the Griptape: Set Default Agent node.", - }); - app.ui.settings.addSetting({ - id: `Griptape.ollama_default_url`, - category: ["Griptape", "Ollama", "ollama_default_url"], - name: "default_url", - type: "text", - defaultValue: "http://127.0.0.1" - }); - app.ui.settings.addSetting({ - id: `Griptape.allow_code_execution_dangerous`, - category: ["Griptape", "!Griptape", "code_execution_dangerous"], - name: "Enable Insecure Griptape Code: Run Python [DANGER]", - type: "boolean", - tooltip: "When enabled, the Griptape Code: Run Python node will not check for dangerous code.\n\n[WARNING] This setting is dangerous and should only be enabled if you know what you are doing.", - defaultValue: false, - onChange: (newVal, oldVal) => { if (newVal == true) { console.warn("Griptape Code: Dangerous Code Execution enabled: ", newVal)} }, - }); - app.ui.settings.addSetting({ - id: `Griptape.allow_code_execution`, - category: ["Griptape", "!Griptape", "code_execution"], - name: "Enable Griptape Code: Run Python Nodes", - type: "boolean", - tooltip: "When enabled, the `Griptape Code: Run Python` node will be available for use.", - defaultValue: false, - // onChange: (newVal, oldVal) => { console.log("Setting got changed!", newVal) }, - }); + // Create the settings + app.ui.settings.addSetting({ + id: `Griptape.default_config`, + category: ["Griptape", "!Griptape", "default_config"], + name: "default_config", + type: "dict", + defaultValue: "", + tooltip: "To set this, use the Griptape: Set Default Agent node.", + }); + app.ui.settings.addSetting({ + id: `Griptape.ollama_default_url`, + category: ["Griptape", "Ollama", "ollama_default_url"], + name: "ollama_default_url", + type: "text", + defaultValue: "http://127.0.0.1", + // onChange: (newVal, oldVal) => { + // console.log("Setting got changed!", newVal); + // }, + }); + app.ui.settings.addSetting({ + id: `Griptape.allow_code_execution_dangerous`, + category: ["Griptape", "!Griptape", "code_execution_dangerous"], + name: "Enable Insecure Griptape Code: Run Python [DANGER]", + type: "boolean", + tooltip: + "When enabled, the Griptape Code: Run Python node will not check for dangerous code.\n\n[WARNING] This setting is dangerous and should only be enabled if you know what you are doing.", + defaultValue: false, + onChange: (newVal, oldVal) => { + if (newVal == true) { + console.warn( + "Griptape Code: Dangerous Code Execution enabled: ", + newVal + ); + } + }, + }); + app.ui.settings.addSetting({ + id: `Griptape.allow_code_execution`, + category: ["Griptape", "!Griptape", "code_execution"], + name: "Enable Griptape Code: Run Python Nodes", + type: "boolean", + tooltip: + "When enabled, the `Griptape Code: Run Python` node will be available for use.", + defaultValue: false, + // onChange: (newVal, oldVal) => { console.log("Setting got changed!", newVal) }, + }); - Object.entries(keys_organized).forEach(([category, keys]) => { - keys.forEach((key) => { - app.ui.settings.addSetting({ - id: `Griptape.${key}`, - category: ["Griptape", category, key], - name: key, - type: "text", - defaultValue: "", - /* To listen for changes, add an onChange parameter + Object.entries(keys_organized).forEach(([category, keys]) => { + keys.forEach((key) => { + app.ui.settings.addSetting({ + id: `Griptape.${key}`, + category: ["Griptape", category, key], + name: key, + type: "text", + defaultValue: "", + /* To listen for changes, add an onChange parameter onChange: (newVal, oldVal) => { console.log("Setting got changed!") }, */ - }); }); }); - - } \ No newline at end of file + }); +} diff --git a/nodes/drivers/gtUIOllamaPromptDriver.py b/nodes/drivers/gtUIOllamaPromptDriver.py index d1ba4ce..f547f39 100644 --- a/nodes/drivers/gtUIOllamaPromptDriver.py +++ b/nodes/drivers/gtUIOllamaPromptDriver.py @@ -12,7 +12,9 @@ class gtUIOllamaPromptDriver(gtUIBasePromptDriver): @classmethod def get_default_url(cls): settings = GriptapeSettings() + settings.read_settings() default_url = settings.get_settings_key("ollama_default_url") + print(f"Ollama default url: {default_url}") return default_url @classmethod From 8f64b35b99424ea1d25d6dbe64e53c208a6feb99 Mon Sep 17 00:00:00 2001 From: Jason Schleifer Date: Sat, 25 Jan 2025 14:44:43 +1300 Subject: [PATCH 2/2] version bump --- CHANGELOG.md | 4 ++++ pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0fec78..d411851 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security --> +## [2.1.14] - 2025-25-01 +### Fixed +- `OllamaPromptDriver` wasn't pulling the default url from settings properly. + ## [2.1.13] - 2025-18-01 ### Added - The `Create Agent` node now has a `max_subtasks` parameter that will try and help make sure the agent doesn't get caught in an infinite loop of tool use. This is especially useful when you have agents using other agents as tools, and sometimes they get "chatty". If they go back and forth too many times, the run will abort and return the reason why & what the last output was in the thread. This should give you some more control over ensuring you don't have agents running forever. diff --git a/pyproject.toml b/pyproject.toml index 7af3b62..06f1e5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "comfyui-griptape" -version = "2.1.13" +version = "2.1.14" description = "Griptape LLM(Large Language Model) Nodes for ComfyUI." authors = ["Jason Schleifer "] readme = "README.md" @@ -9,7 +9,7 @@ readme = "README.md" [project] name = "comfyui-griptape" description = "Griptape LLM(Large Language Model) Nodes for ComfyUI." -version = "2.1.13" +version = "2.1.14" license = {file = "LICENSE"} dependencies = ["attrs>=24.3.0,<25.0.0", "openai>=1.58.1,<2.0.0", "griptape[all]>=1.1.3", "python-dotenv", "poetry==1.8.5", "griptape-black-forest @ git+https://github.com/griptape-ai/griptape-black-forest.git"]