|
@@ -2,7 +2,7 @@
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
import { toast } from 'svelte-sonner';
|
|
import { toast } from 'svelte-sonner';
|
|
import { goto } from '$app/navigation';
|
|
import { goto } from '$app/navigation';
|
|
- import { settings, user, config, models } from '$lib/stores';
|
|
|
|
|
|
+ import { settings, user, config, models, tools } from '$lib/stores';
|
|
|
|
|
|
import { onMount, tick, getContext } from 'svelte';
|
|
import { onMount, tick, getContext } from 'svelte';
|
|
import { addNewModel, getModelById, getModelInfos } from '$lib/apis/models';
|
|
import { addNewModel, getModelById, getModelInfos } from '$lib/apis/models';
|
|
@@ -12,6 +12,8 @@
|
|
import Checkbox from '$lib/components/common/Checkbox.svelte';
|
|
import Checkbox from '$lib/components/common/Checkbox.svelte';
|
|
import Tags from '$lib/components/common/Tags.svelte';
|
|
import Tags from '$lib/components/common/Tags.svelte';
|
|
import Knowledge from '$lib/components/workspace/Models/Knowledge.svelte';
|
|
import Knowledge from '$lib/components/workspace/Models/Knowledge.svelte';
|
|
|
|
+ import ToolsSelector from '$lib/components/workspace/Models/ToolsSelector.svelte';
|
|
|
|
+ import { stringify } from 'postcss';
|
|
|
|
|
|
const i18n = getContext('i18n');
|
|
const i18n = getContext('i18n');
|
|
|
|
|
|
@@ -54,6 +56,7 @@
|
|
vision: true
|
|
vision: true
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ let toolIds = [];
|
|
let knowledge = [];
|
|
let knowledge = [];
|
|
|
|
|
|
$: if (name) {
|
|
$: if (name) {
|
|
@@ -88,6 +91,14 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (toolIds.length > 0) {
|
|
|
|
+ info.meta.toolIds = toolIds;
|
|
|
|
+ } else {
|
|
|
|
+ if (info.meta.toolIds) {
|
|
|
|
+ delete info.meta.toolIds;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null;
|
|
info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null;
|
|
Object.keys(info.params).forEach((key) => {
|
|
Object.keys(info.params).forEach((key) => {
|
|
if (info.params[key] === '' || info.params[key] === null) {
|
|
if (info.params[key] === '' || info.params[key] === null) {
|
|
@@ -154,6 +165,7 @@
|
|
params.stop = params?.stop ? (params?.stop ?? []).join(',') : null;
|
|
params.stop = params?.stop ? (params?.stop ?? []).join(',') : null;
|
|
|
|
|
|
capabilities = { ...capabilities, ...(model?.info?.meta?.capabilities ?? {}) };
|
|
capabilities = { ...capabilities, ...(model?.info?.meta?.capabilities ?? {}) };
|
|
|
|
+ toolIds = model?.info?.meta?.toolIds ?? [];
|
|
|
|
|
|
info = {
|
|
info = {
|
|
...info,
|
|
...info,
|
|
@@ -554,6 +566,10 @@
|
|
<Knowledge bind:knowledge />
|
|
<Knowledge bind:knowledge />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
+ <div class="my-2">
|
|
|
|
+ <ToolsSelector bind:selectedToolIds={toolIds} tools={$tools} />
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<div class="my-1">
|
|
<div class="my-1">
|
|
<div class="flex w-full justify-between mb-1">
|
|
<div class="flex w-full justify-between mb-1">
|
|
<div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div>
|
|
<div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div>
|