|
7 | 7 | * }} |
8 | 8 | */ |
9 | 9 | let { agent } = $props(); |
| 10 | +
|
| 11 | + /** @param {number} count @param {string} singular @param {string} plural */ |
| 12 | + const pluralize = (count, singular, plural) => `${count || 0} ${count > 1 ? plural : singular}`; |
| 13 | +
|
| 14 | + let stats = $derived([ |
| 15 | + agent?.profiles && pluralize(agent.profiles.length, 'profile', 'profiles'), |
| 16 | + agent?.functions && pluralize(agent.functions.length, 'function', 'functions'), |
| 17 | + agent?.utilities && pluralize(agent.utilities.length, 'utility', 'utilities'), |
| 18 | + agent?.mcp_tools && pluralize(agent.mcp_tools.length, 'MCP', 'MCPs') |
| 19 | + ].filter(Boolean).join(', ')); |
10 | 20 | </script> |
11 | 21 |
|
12 | 22 | <div class="cai-wrapper"> |
|
34 | 44 | </div> |
35 | 45 | <div class="cai-row"> |
36 | 46 | <div class="cai-meta"> |
37 | | - {#if !!agent?.profiles} |
38 | | - <span>{agent?.profiles?.length || 0} {agent?.profiles?.length > 1 ? 'profiles' : 'profile'}{', '}</span> |
39 | | - {/if} |
40 | | - {#if !!agent?.functions} |
41 | | - <span>{agent?.functions?.length || 0} {agent?.functions?.length > 1 ? 'functions' : 'function'}{', '}</span> |
42 | | - {/if} |
43 | | - {#if !!agent?.utilities} |
44 | | - <span>{agent?.utilities?.length || 0} {agent?.utilities?.length > 1 ? 'utilities' : 'utility'}{', '}</span> |
45 | | - {/if} |
46 | | - {#if !!agent?.mcp_tools} |
47 | | - <span>{agent?.mcp_tools?.length || 0} {agent?.mcp_tools?.length > 1 ? 'MCPs' : 'MCP'}</span> |
48 | | - {/if} |
| 47 | + <span>{stats}</span> |
49 | 48 | </div> |
50 | 49 | </div> |
51 | 50 | </div> |
|
0 commit comments