Skip to content

Commit

Permalink
Merge pull request #236 from griptape-ai:update/ollama
Browse files Browse the repository at this point in the history
Update/ollama
  • Loading branch information
shhlife authored Jan 25, 2025
2 parents 44ab134 + 8f64b35 commit ebe7b59
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 48 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
103 changes: 57 additions & 46 deletions js/settings.js
Original file line number Diff line number Diff line change
@@ -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!") },
*/
});
});
});

}
});
}
2 changes: 2 additions & 0 deletions nodes/drivers/gtUIOllamaPromptDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand All @@ -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"]

Expand Down

0 comments on commit ebe7b59

Please sign in to comment.