feat: 更新数据集创建功能,使用 TargetModels 类型替代字符串作为目标模型
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import type { TargetModels } from "$lib/types/models";
|
||||
|
||||
export type DatasetMeta = {
|
||||
name: string;
|
||||
targetModel: string;
|
||||
targetModel: TargetModels;
|
||||
loraType: string;
|
||||
unifiedImageSize: boolean;
|
||||
unifiedImageRatio: boolean;
|
||||
|
||||
@@ -4,6 +4,7 @@ import Close from '$lib/components/icons/Close.svelte';
|
||||
import { activeDatasetMeta, openedDatasetDir, updateActiveDatasetMeta } from '$lib/stores/dataset';
|
||||
import { currentActivate } from '$lib/stores/navigate';
|
||||
import type { DatasetMeta } from '$lib/types/meta';
|
||||
import { ModelChoices } from '$lib/types/models';
|
||||
import { message, open } from '@tauri-apps/plugin-dialog';
|
||||
import { readDir } from '@tauri-apps/plugin-fs';
|
||||
import { isNil } from 'es-toolkit';
|
||||
@@ -14,6 +15,7 @@ afterNavigate(() => {
|
||||
|
||||
let storePath = $state('');
|
||||
let datasetName = $state('');
|
||||
let targetModel = $state(ModelChoices[0].value);
|
||||
|
||||
async function backToBoot() {
|
||||
await goto('/boot');
|
||||
@@ -58,7 +60,7 @@ async function createDataset() {
|
||||
if (!isNil(storePath) && !isNil(datasetName) && storePath.trim() && datasetName.trim()) {
|
||||
const datasetMeta: DatasetMeta = {
|
||||
name: datasetName.trim(),
|
||||
targetModel: '',
|
||||
targetModel: targetModel,
|
||||
loraType: '',
|
||||
unifiedImageSize: true,
|
||||
unifiedImageRatio: true,
|
||||
@@ -109,5 +111,13 @@ async function createDataset() {
|
||||
<span class="label min-w-[10em]">Dataset Name</span>
|
||||
<input type="text" class="min-w-[20em]" bind:value={datasetName} />
|
||||
</label>
|
||||
<label class="input input-md focus-within:outline-0 w-fit">
|
||||
<span class="label min-w-[10em]">Target Model</span>
|
||||
<select class="min-w-[20em] focus:outline-0" bind:value={targetModel}>
|
||||
{#each ModelChoices as model}
|
||||
<option value={model.value}>{model.label}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
<button class="btn btn-primary btn-md w-fit self-center" onclick={createDataset}>Create</button>
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user