File size: 2,283 Bytes
cfb0fa4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | <script lang="ts">
import { getContext } from 'svelte';
import Checkbox from '$lib/components/common/Checkbox.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import { marked } from 'marked';
const i18n = getContext('i18n');
const toolLabels = {
time: {
label: $i18n.t('Time & Calculation'),
description: $i18n.t('Get current time and perform date/time calculations')
},
memory: {
label: $i18n.t('Memory'),
description: $i18n.t('Search and manage user memories')
},
chats: {
label: $i18n.t('Chat History'),
description: $i18n.t('Search and view user chat history')
},
notes: {
label: $i18n.t('Notes'),
description: $i18n.t('Search, view, and manage user notes')
},
knowledge: {
label: $i18n.t('Knowledge Base'),
description: $i18n.t('Browse and query knowledge bases')
},
channels: {
label: $i18n.t('Channels'),
description: $i18n.t('Search channels and channel messages')
},
web_search: {
label: $i18n.t('Web Search'),
description: $i18n.t('Search the web and fetch URLs')
},
image_generation: {
label: $i18n.t('Image Generation'),
description: $i18n.t('Generate and edit images')
},
code_interpreter: {
label: $i18n.t('Code Interpreter'),
description: $i18n.t('Execute code')
}
};
const allTools = Object.keys(toolLabels);
export let builtinTools: Record<string, boolean> = {};
// Initialize missing keys to true (default enabled)
$: {
for (const tool of allTools) {
if (!(tool in builtinTools)) {
builtinTools[tool] = true;
}
}
}
</script>
<div>
<div class="flex w-full justify-between mb-1">
<div class="self-center text-xs font-medium text-gray-500">{$i18n.t('Builtin Tools')}</div>
</div>
<div class="flex items-center mt-2 flex-wrap">
{#each allTools as tool}
<div class="flex items-center gap-2 mr-3">
<Checkbox
state={builtinTools[tool] !== false ? 'checked' : 'unchecked'}
on:change={(e) => {
builtinTools = {
...builtinTools,
[tool]: e.detail === 'checked'
};
}}
/>
<div class="py-0.5 text-sm">
<Tooltip content={marked.parse(toolLabels[tool].description)}>
{$i18n.t(toolLabels[tool].label)}
</Tooltip>
</div>
</div>
{/each}
</div>
</div>
|