From 309bd70dc330a432b8f341cbf545ab5283ca945f Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Sat, 1 Mar 2025 14:49:31 +0800 Subject: [PATCH] feat: Assign a server and model on tiddler if user lazy or forget to pick one. --- plugins/tiddlywiki/ai-tools/globals.tid | 18 +++++++++++++++++- .../tiddlywiki/ai-tools/settings/settings.tid | 2 +- .../ai-tools/utilities/utilities.tid | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/plugins/tiddlywiki/ai-tools/globals.tid b/plugins/tiddlywiki/ai-tools/globals.tid index 20bd3b077..6215de226 100644 --- a/plugins/tiddlywiki/ai-tools/globals.tid +++ b/plugins/tiddlywiki/ai-tools/globals.tid @@ -116,9 +116,25 @@ Procedure to display a message from an AI conversation. Current tiddler is the c \end \procedure ai-tools-action-get-response() + +<% if [!has[completion-server]] %> + <$action-setfield + $tiddler=<> + $field="completion-server" + $value={{{[all[shadows+tiddlers]tag[$:/tags/AI/CompletionServer]sort[caption]first[]]}}} + /> +<% endif %> +<% if [!has[completion-model]] %> + <$action-setfield + $tiddler=<> + $field="completion-model" + $value={{{[{!!completion-server}get[models]enlist-input[]first[]]}}} + /> +<% endif %> + <$let resultTitlePrefix={{{ [addsuffix[ - Prompt]] }}} resultTags={{{ [format:titlelist[]] }}} diff --git a/plugins/tiddlywiki/ai-tools/settings/settings.tid b/plugins/tiddlywiki/ai-tools/settings/settings.tid index bfb7e9aaf..38614b220 100644 --- a/plugins/tiddlywiki/ai-tools/settings/settings.tid +++ b/plugins/tiddlywiki/ai-tools/settings/settings.tid @@ -5,4 +5,4 @@ These settings let you customise the behaviour of the "AI Tools" plugin. !! Completion Servers -<> +<> diff --git a/plugins/tiddlywiki/ai-tools/utilities/utilities.tid b/plugins/tiddlywiki/ai-tools/utilities/utilities.tid index 5a6c9a6c8..ce98eec61 100644 --- a/plugins/tiddlywiki/ai-tools/utilities/utilities.tid +++ b/plugins/tiddlywiki/ai-tools/utilities/utilities.tid @@ -1,3 +1,3 @@ title: $:/plugins/tiddlywiki/ai-tools/utilities -<> +<>