fix: 生图页默认选中列表第一个模型(原固定挑pollinations开头)
This commit is contained in:
1 parent
14bc300146
commit
c78f322521
1 file changed
+6
-6
@@ -2,7 +2,7 @@
|
||||
import { getMachineId, licenseHeaders } from '@/tools/license/license';
|
||||
|
||||
const models = ref<{ id: string; i2i: boolean; custom?: boolean }[]>([]);
|
||||
const model = ref('pollinations-flux');
|
||||
const model = ref(''); // 打开页面默认选中列表第一个模型
|
||||
const prompt = ref('');
|
||||
const loading = ref(false);
|
||||
const error = ref('');
|
||||
@@ -94,6 +94,7 @@ function mergeModels() {
|
||||
const inhouse = inhouseModels.map((m) => ({ ...m, custom: false }));
|
||||
const mine = provider.value.models.map((id) => ({ id, i2i: false, custom: true }));
|
||||
models.value = [...inhouse, ...mine];
|
||||
if (!model.value && models.value.length) model.value = models.value[0].id;
|
||||
}
|
||||
|
||||
// ---------- 生成历史(服务端落盘,点缩略图回看/下载) ----------
|
||||
@@ -289,10 +290,9 @@ onMounted(async () => {
|
||||
if (j.code === 200 && Array.isArray(j.data) && j.data.length) {
|
||||
inhouseModels = j.data;
|
||||
mergeModels();
|
||||
if (!models.value.some((m: any) => m.id === model.value)) {
|
||||
// 默认选一个 pollinations(稳定可用)
|
||||
const p = j.data.find((m: any) => m.id.startsWith('pollinations'));
|
||||
model.value = (p || j.data[0]).id;
|
||||
if (!model.value || !models.value.some((m: any) => m.id === model.value)) {
|
||||
// 默认选中列表第一个模型
|
||||
model.value = j.data[0].id;
|
||||
}
|
||||
} else {
|
||||
mergeModels();
|
||||
@@ -372,7 +372,7 @@ async function generate() {
|
||||
<optgroup v-if="models.some(x => x.custom)" label="我的模型">
|
||||
<option v-for="m in models.filter(x => x.custom)" :key="m.id" :value="m.id">{{ m.id }}(我的)</option>
|
||||
</optgroup>
|
||||
<option v-if="!models.length" value="pollinations-flux">pollinations-flux</option>
|
||||
<option v-if="!models.length" value="">选择模型…</option>
|
||||
</select>
|
||||
<div class="gen-pills">
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user