1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-04-05 18:26:56 +00:00

feat: Assign a server and model on tiddler if user lazy or forget to pick one.

This commit is contained in:
lin onetwo 2025-03-01 14:49:31 +08:00
parent b36946badb
commit 309bd70dc3
3 changed files with 19 additions and 3 deletions

View File

@ -116,9 +116,25 @@ Procedure to display a message from an AI conversation. Current tiddler is the c
\end
<!--
Action procedure to get the next response from the LLM
Action procedure to get the next response from the LLM on a chat tiddler.
-->
\procedure ai-tools-action-get-response()
<!-- Assign a server and model on tiddler if user forget to pick one. -->
<% if [<currentTiddler>!has[completion-server]] %>
<$action-setfield
$tiddler=<<currentTiddler>>
$field="completion-server"
$value={{{[all[shadows+tiddlers]tag[$:/tags/AI/CompletionServer]sort[caption]first[]]}}}
/>
<% endif %>
<% if [<currentTiddler>!has[completion-model]] %>
<$action-setfield
$tiddler=<<currentTiddler>>
$field="completion-model"
$value={{{[{!!completion-server}get[models]enlist-input[]first[]]}}}
/>
<% endif %>
<!-- Get the response -->
<$let
resultTitlePrefix={{{ [<currentTiddler>addsuffix[ - Prompt]] }}}
resultTags={{{ [<currentTiddler>format:titlelist[]] }}}

View File

@ -5,4 +5,4 @@ These settings let you customise the behaviour of the "AI Tools" plugin.
!! Completion Servers
<<tabs "[all[shadows]tag[$:/tags/AI/ServerSetting]]">>
<<tabs "[all[shadows+tiddlers]tag[$:/tags/AI/ServerSetting]]">>

View File

@ -1,3 +1,3 @@
title: $:/plugins/tiddlywiki/ai-tools/utilities
<<tabs "[all[shadows]tag[$:/tags/AI/Utility]]">>
<<tabs "[all[shadows+tiddlers]tag[$:/tags/AI/Utility]]">>