Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/helpers/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ function skipLoader(config) {
new RegExp('http(s*)://(.*?)/conversation/state/keys', 'g'),
new RegExp('http(s*)://(.*?)/logger/instruction/log/keys', 'g'),
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/content-log', 'g'),
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/state-log', 'g')
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/state-log', 'g'),
new RegExp('http(s*)://(.*?)/mcp/server-configs', 'g')
];

if (config.method === 'post' && postRegexes.some(regex => regex.test(config.url || ''))) {
Expand Down
19 changes: 11 additions & 8 deletions src/lib/helpers/types/agentTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
* @property {boolean} merge_utility - Merge utility
* @property {number?} [max_message_count]
* @property {AgentUtility[]} utilities - The agent utilities.
* @property {AgentMcpTool[]} mcp_tools - The agent mcp tools
* @property {AgentKnowledgeBase[]} knowledge_bases - The agent knowledge bases.
* @property {Date} created_datetime
* @property {Date} updated_datetime
Expand Down Expand Up @@ -131,8 +132,16 @@
* @typedef {Object} AgentUtility
* @property {string} name
* @property {boolean} disabled
* @property {UtilityBase[]} functions
* @property {UtilityBase[]} templates
* @property {import('$commonTypes').NameBase[]} functions
* @property {import('$commonTypes').NameBase[]} templates
*/

/**
* @typedef {Object} AgentMcpTool
* @property {string} name
* @property {string} server_id
* @property {boolean} disabled
* @property {import('$commonTypes').NameBase[]} functions
*/

/**
Expand All @@ -152,12 +161,6 @@
* @property {boolean} disabled
*/

/**
* @typedef {Object} UtilityBase
* @property {string} name
* @property {string?} [displayName]
*/


/**
* @typedef {Object} AgentTaskSearchOption
Expand Down
6 changes: 6 additions & 0 deletions src/lib/helpers/types/commonTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@
* @property {any} payload
*/

/**
* @typedef {Object} NameBase
* @property {string} name
* @property {string?} [displayName]
*/

export default {};
8 changes: 8 additions & 0 deletions src/lib/helpers/types/mcpTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @typedef {Object} McpServerConfigModel
* @property {string} id - The server id.
* @property {string} name - The server name.
* @property {string} transport_type - The transport type.
*/

export default {};
4 changes: 3 additions & 1 deletion src/lib/services/api-endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export const endpoints = {
dashConversationInstructionUrl: `${host}/dashboard/component/conversation`,

// Google geocode api
addressUrl: `${host}/address/options`
addressUrl: `${host}/address/options`,

mcpServerConfigsUrl: `${host}/mcp/server-configs`
}

12 changes: 12 additions & 0 deletions src/lib/services/mcp-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { endpoints } from '$lib/services/api-endpoints.js';
import axios from 'axios';

/**
* Get mcp server configs
* @returns {Promise<import('$mcpTypes').McpServerConfigModel[]>}
*/
export async function getServerConfigs() {
const url = endpoints.mcpServerConfigsUrl;
const response = await axios.get(url);
return response.data;
}
4 changes: 3 additions & 1 deletion src/routes/page/agent/[agentId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@
return data ? {
utilities: data.utilities || [],
knowledge_bases: data.knwoledgebases || [],
rules: data.rules || []
rules: data.rules || [],
mcp_tools: data.mcpTools || []
} : null;
}

Expand All @@ -198,6 +199,7 @@
agent.utilities = data.utilities || [];
agent.knowledge_bases = data.knwoledgebases || [];
agent.rules = data.rules || [];
agent.mcp_tools = data.mcpTools || [];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
e.preventDefault();
const value = e.target.value;
selected_instruction.instruction = value || '';
handleAgentChange();
}

function addChannel() {
Expand All @@ -107,6 +108,7 @@
];

selected_instruction = inner_instructions[inner_instructions.length-1];
handleAgentChange();
}

/** @param {string | undefined} uid */
Expand All @@ -115,6 +117,7 @@
if (selected_instruction.uid === uid) {
selected_instruction = inner_instructions[0];
}
handleAgentChange();
}
</script>

Expand Down Expand Up @@ -161,7 +164,7 @@
data-bs-placement="top"
title="Add channel instruction"
style="font-size: 16px;"
on:click={() => { addChannel(); handleAgentChange(); }}
on:click={() => addChannel()}
>
<i class="mdi mdi-plus-circle-outline" />
</div>
Expand All @@ -187,7 +190,7 @@
maxEditLength={20}
editPlaceholder={'Type a channel here...'}
onClick={() => selectChannel(inst.uid)}
onDelete={() => { deleteChannel(inst.uid); handleAgentChange(); }}
onDelete={() => deleteChannel(inst.uid)}
onInput={handleAgentChange}
/>
{/each}
Expand All @@ -199,7 +202,7 @@
style="scrollbar-width: thin; resize: none;"
value={selected_instruction.instruction}
rows={20}
on:input={(e) => { changePrompt(e); handleAgentChange(); }}
on:input={(e) => changePrompt(e)}
placeholder="Enter your instruction"
/>
</FormGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
const vals = e.target.value.split("#");
found.name = vals[0];
found.type = vals[1];
handleAgentChange();
innerRefresh(innerKnowledgeBases);
handleAgentChange();
}

/**
Expand All @@ -111,8 +111,8 @@
const value = e.target.value;
const confidence = validateConfidenceNumber(value);
found.confidence = confidence;
handleAgentChange();
innerRefresh(innerKnowledgeBases);
handleAgentChange();
}

/** @param {any} e */
Expand Down Expand Up @@ -166,8 +166,8 @@
if (!found) return;

found.disabled = !e.target.checked;
handleAgentChange();
innerRefresh(innerKnowledgeBases);
handleAgentChange();
}


Expand Down
Loading