feat: 添加数据集信息表单组件,包含数据集名称和目标模型选择
This commit is contained in:
@@ -4,6 +4,7 @@ import { activeDatasetMeta } from '$lib/stores/dataset';
|
|||||||
import { currentActivate } from '$lib/stores/navigate';
|
import { currentActivate } from '$lib/stores/navigate';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
|
import DatasetInfoForm from './DatasetInfoForm.svelte';
|
||||||
|
|
||||||
afterNavigate(() => {
|
afterNavigate(() => {
|
||||||
currentActivate.set('dataset');
|
currentActivate.set('dataset');
|
||||||
@@ -15,6 +16,7 @@ afterNavigate(() => {
|
|||||||
<main class="px-4 py-4 size-full flex flex-col items-stretch gap-1 overflow-hidden">
|
<main class="px-4 py-4 size-full flex flex-col items-stretch gap-1 overflow-hidden">
|
||||||
<h2>Dataset Settings</h2>
|
<h2>Dataset Settings</h2>
|
||||||
<hr class="border-zinc-500" />
|
<hr class="border-zinc-500" />
|
||||||
|
<DatasetInfoForm />
|
||||||
<h2>Environment Check</h2>
|
<h2>Environment Check</h2>
|
||||||
<hr class="border-zinc-500" />
|
<hr class="border-zinc-500" />
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
9
src/routes/dataset/DatasetInfoForm.svelte
Normal file
9
src/routes/dataset/DatasetInfoForm.svelte
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import DatasetName from './meta-form/DatasetName.svelte';
|
||||||
|
import SelectModel from './meta-form/SelectModel.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2 px-4 py-4">
|
||||||
|
<DatasetName />
|
||||||
|
<SelectModel />
|
||||||
|
</div>
|
||||||
16
src/routes/dataset/meta-form/DatasetName.svelte
Normal file
16
src/routes/dataset/meta-form/DatasetName.svelte
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { activeDatasetMeta } from '$lib/stores/dataset';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
|
let name = $state('');
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
name = get(activeDatasetMeta)?.name ?? '';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<label class="input w-fit in-focus-within:outline-0">
|
||||||
|
<span class="label min-w-[10em]">Dataset Name</span>
|
||||||
|
<input type="text" bind:value={name} class="min-w-[20em] focus:outline-0" />
|
||||||
|
</label>
|
||||||
23
src/routes/dataset/meta-form/SelectModel.svelte
Normal file
23
src/routes/dataset/meta-form/SelectModel.svelte
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { activeDatasetMeta } from '$lib/stores/dataset';
|
||||||
|
import { ModelChoices, type TargetModels } from '$lib/types/models';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { get } from 'svelte/store';
|
||||||
|
|
||||||
|
let selected: TargetModels | null = $state(null);
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
selected = get(activeDatasetMeta)?.targetModel ?? null;
|
||||||
|
});
|
||||||
|
|
||||||
|
async function saveTargetModel() {}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<label class="input w-fit in-focus-within:outline-0">
|
||||||
|
<span class="label min-w-[10em]">Target Model</span>
|
||||||
|
<select bind:value={selected} onselect={saveTargetModel} class="min-w-[20em] focus:outline-0">
|
||||||
|
{#each ModelChoices as model}
|
||||||
|
<option value={model.value}>{model.label}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
Reference in New Issue
Block a user