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
7 changes: 7 additions & 0 deletions src/lib/helpers/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ export function range(size = 3, startAt = 0) {
*/
export function buildUrl(baseUrl, relativePath) {
return new URL(relativePath, baseUrl);
}

/** @param {string} agentId */
export function directToAgentPage(agentId) {
if (!agentId) return;

window.open(`/page/agent/${agentId}`);
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
<script>
import { directToAgentPage } from '$lib/helpers/utils/common';

/** @type {import('$types').AgentModel} */
export let agent;
</script>

<div>
<div class="chat-agent-row">
<h3 class="text-primary fw-bold">
{agent?.name || ''}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<h3
class="text-primary fw-bold"
on:click={() => directToAgentPage(agent?.id)}
>
<span class="clickable">{agent?.name || ''}</span>
</h3>
</div>
<div class="chat-agent-row">
<div class="text-secondary">
{agent?.description || ''}
<span>{agent?.description || ''}</span>
</div>
</div>
<div class="chat-agent-row">
<div>
{agent?.llm_config?.provider || ''}{!!agent?.llm_config?.provider ? ',': ''} {agent?.llm_config?.model || ''}
<span>{agent?.llm_config?.provider || ''}{!!agent?.llm_config?.provider ? ',': ''} {agent?.llm_config?.model || ''}</span>
</div>
</div>
<div class="chat-agent-row">
<div>
<span>
{agent?.profiles?.length || 0} {agent?.profiles?.length > 1 ? 'profiles' : 'profile'}{!!agent?.profiles ? ', ' : ''}
{agent?.functions?.length || 0} {agent?.functions?.length > 1 ? 'functions' : 'function'}{!!agent?.functions ? ', ' : ''}
{agent?.templates?.length || 0} {agent?.templates?.length > 1 ? 'templates' : 'template'}{!!agent?.templates ? ', ' : ''}
{agent?.utilities?.length || 0} {agent?.utilities?.length > 1 ? 'utilities' : 'utility'}
</span>
{#if !!agent?.profiles}
<span>{agent?.profiles?.length || 0} {agent?.profiles?.length > 1 ? 'profiles' : 'profile'}{', '}</span>
{/if}
{#if !!agent?.functions}
<span>{agent?.functions?.length || 0} {agent?.functions?.length > 1 ? 'functions' : 'function'}{', '}</span>
{/if}
{#if !!agent?.utilities}
<span>{agent?.utilities?.length || 0} {agent?.utilities?.length > 1 ? 'utilities' : 'utility'}</span>
{/if}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Markdown from "$lib/common/Markdown.svelte";
import { ContentLogSource } from '$lib/helpers/enums';
import { utcToLocal } from '$lib/helpers/datetime';
import { directToAgentPage } from '$lib/helpers/utils/common';

/** @type {import('$types').ConversationContentLogModel} */
export let data;
Expand Down Expand Up @@ -33,11 +34,6 @@
e.preventDefault();
is_collapsed = !is_collapsed;
}

/** @param {string} agentId */
function directToAgentDetailPage(agentId) {
window.open(`/page/agent/${agentId}`);
}
</script>

<div class="log-element rounded" style="padding: 3px;" id={`content-log-${data.message_id}`}>
Expand All @@ -46,7 +42,7 @@
{#if data?.name?.length > 0}
<span class="h4">
{#if data?.agent_id?.length > 0}
<Link class="text-white" on:click={() => directToAgentDetailPage(data.agent_id)}>
<Link class="text-white" on:click={() => directToAgentPage(data.agent_id)}>
{data.name}
</Link>
{:else}
Expand Down
9 changes: 2 additions & 7 deletions src/routes/page/agent/[agentId]/agent-routing.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<script>
import CollapsibleCard from "$lib/common/CollapsibleCard.svelte";
import { directToAgentPage } from "$lib/helpers/utils/common";
import { Card, CardBody, Table } from "@sveltestrap/sveltestrap";

/** @type {import('$types').AgentModel} */
export let agent;

/** @param {string} agentId */
function redirectToAgent(agentId) {
window.open(`/page/agent/${agentId}`);
}

</script>

<Card>
Expand Down Expand Up @@ -53,7 +48,7 @@
{#if !!rule.redirectTo}
<tr>
<th class="agent-prop-key">Redirect to Agent</th>
<td style="cursor: pointer;" on:click={() => redirectToAgent(rule.redirectTo)}>
<td style="cursor: pointer;" on:click={() => directToAgentPage(rule.redirectTo)}>
{rule.redirect_to_agent || ''}
</td>
</tr>
Expand Down