diff --git a/src/lib/helpers/types/instructTypes.js b/src/lib/helpers/types/instructTypes.js
index 102936a7..c60cd137 100644
--- a/src/lib/helpers/types/instructTypes.js
+++ b/src/lib/helpers/types/instructTypes.js
@@ -1,7 +1,11 @@
/**
* @typedef {Object} InstructMessageModel
+ * @property {string} text - The user message.
* @property {string} [instruction] - User provided prompt instead of predefined template.
- * @property {string} [template] - The template name.
+ * @property {string?} [template] - The template name.
+ * @property {string?} [provider] - The LLM provider.
+ * @property {string?} [model] - The LLM model.
+ * @property {import('$conversationTypes').ConversationStateModel[]} [states]
*/
/**
diff --git a/src/lib/services/instruct-service.js b/src/lib/services/instruct-service.js
index 1c40229c..33f28915 100644
--- a/src/lib/services/instruct-service.js
+++ b/src/lib/services/instruct-service.js
@@ -6,11 +6,13 @@ import qs from 'qs';
/**
* Execute agent instruction by template or user provided prompt.
* @param {string} agentId
- * @param {import('$instructTypes').InstructMessageModel} instruction
+ * @param {import('$instructTypes').InstructMessageModel} request
+ * @returns {Promise<{ text: string }>}
*/
-export async function executeAgentInstruction(agentId, instruction) {
- let url = replaceUrl(endpoints.instructCompletionUrl, {agentId: agentId});
- await axios.post(url, instruction);
+export async function executeAgentInstruction(agentId, request) {
+ const url = replaceUrl(endpoints.instructCompletionUrl, {agentId: agentId});
+ const response = await axios.post(url, request);
+ return response.data;
}
diff --git a/src/routes/page/instruction/instruction-components/instruction-template.svelte b/src/routes/page/instruction/instruction-components/instruction-agent.svelte
similarity index 75%
rename from src/routes/page/instruction/instruction-components/instruction-template.svelte
rename to src/routes/page/instruction/instruction-components/instruction-agent.svelte
index e7a9ffbe..4d3559c9 100644
--- a/src/routes/page/instruction/instruction-components/instruction-template.svelte
+++ b/src/routes/page/instruction/instruction-components/instruction-agent.svelte
@@ -29,7 +29,7 @@
* @param {import('$agentTypes').AgentModel[]} agents
*/
function collectAgentOptions(agents) {
- agentOptions = agents?.filter(x => x.templates?.length > 0).map(x => ({
+ agentOptions = agents?.map(x => ({
label: x.name,
value: x.id
}))?.sort((a, b) => a.label.localeCompare(b.label)) || [];
@@ -61,7 +61,7 @@
}
function dispatchEvent() {
- svelteDispatch('agentSelected', {
+ svelteDispatch('selectAgent', {
agent: selectedAgent || null,
template: selectedTemplate || null
});
@@ -73,12 +73,6 @@
Agent
-