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