You've already forked iFlow-Settings-Editor-GUI
优化 API配置编辑对话框的数据回填逻辑
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "iflow-settings-editor",
|
"name": "iflow-settings-editor",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "一个用于编辑 iFlow CLI 配置文件的桌面应用程序。",
|
"description": "一个用于编辑 iFlow CLI 配置文件的桌面应用程序。",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"author": "上海潘哆呐科技有限公司",
|
"author": "上海潘哆呐科技有限公司",
|
||||||
|
|||||||
18
src/App.vue
18
src/App.vue
@@ -126,14 +126,14 @@
|
|||||||
使用中
|
使用中
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile-actions" v-if="profile.name !== 'default'">
|
<div class="profile-actions">
|
||||||
<button class="action-btn" @click.stop="openApiEditDialog(profile.name)" title="编辑">
|
<button class="action-btn" @click.stop="openApiEditDialog(profile.name)" title="编辑">
|
||||||
<Edit size="14" />
|
<Edit size="14" />
|
||||||
</button>
|
</button>
|
||||||
<button class="action-btn" @click.stop="duplicateApiProfile(profile.name)" title="复制">
|
<button class="action-btn" @click.stop="duplicateApiProfile(profile.name)" title="复制">
|
||||||
<Copy size="14" />
|
<Copy size="14" />
|
||||||
</button>
|
</button>
|
||||||
<button class="action-btn action-btn-danger" @click.stop="deleteApiProfile(profile.name)" title="删除">
|
<button class="action-btn action-btn-danger" v-if="profile.name !== 'default'" @click.stop="deleteApiProfile(profile.name)" title="删除">
|
||||||
<Delete size="14" />
|
<Delete size="14" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -624,12 +624,12 @@ const openApiEditDialog = profileName => {
|
|||||||
// 从 apiProfiles 中加载指定配置的数据
|
// 从 apiProfiles 中加载指定配置的数据
|
||||||
const profile = settings.value.apiProfiles && settings.value.apiProfiles[profileName]
|
const profile = settings.value.apiProfiles && settings.value.apiProfiles[profileName]
|
||||||
editingApiData.value = {
|
editingApiData.value = {
|
||||||
selectedAuthType: profile ? profile.selectedAuthType : settings.value.selectedAuthType || 'iflow',
|
selectedAuthType: (profile && profile.selectedAuthType) || settings.value.selectedAuthType || 'openai-compatible',
|
||||||
apiKey: profile ? profile.apiKey : settings.value.apiKey || '',
|
apiKey: (profile && profile.apiKey) || settings.value.apiKey || '',
|
||||||
baseUrl: profile ? profile.baseUrl : settings.value.baseUrl || '',
|
baseUrl: (profile && profile.baseUrl) || settings.value.baseUrl || '',
|
||||||
modelName: profile ? profile.modelName : settings.value.modelName || '',
|
modelName: (profile && profile.modelName) || settings.value.modelName || '',
|
||||||
searchApiKey: profile ? profile.searchApiKey : settings.value.searchApiKey || '',
|
searchApiKey: (profile && profile.searchApiKey) || settings.value.searchApiKey || '',
|
||||||
cna: profile ? profile.cna : settings.value.cna || '',
|
cna: (profile && profile.cna) || settings.value.cna || '',
|
||||||
}
|
}
|
||||||
showApiEditDialog.value = true
|
showApiEditDialog.value = true
|
||||||
}
|
}
|
||||||
@@ -673,7 +673,7 @@ const loadSettings = async () => {
|
|||||||
if (data.theme === undefined) data.theme = 'Xcode'
|
if (data.theme === undefined) data.theme = 'Xcode'
|
||||||
if (data.bootAnimationShown === undefined) data.bootAnimationShown = true
|
if (data.bootAnimationShown === undefined) data.bootAnimationShown = true
|
||||||
// 确保 API 相关字段有默认值
|
// 确保 API 相关字段有默认值
|
||||||
if (data.selectedAuthType === undefined) data.selectedAuthType = 'openai-compatible'
|
if (!data.selectedAuthType) data.selectedAuthType = 'openai-compatible'
|
||||||
if (data.apiKey === undefined) data.apiKey = ''
|
if (data.apiKey === undefined) data.apiKey = ''
|
||||||
if (data.baseUrl === undefined) data.baseUrl = ''
|
if (data.baseUrl === undefined) data.baseUrl = ''
|
||||||
if (data.modelName === undefined) data.modelName = ''
|
if (data.modelName === undefined) data.modelName = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user