fix: 修复配置加载失败时回退到模拟数据的问题
移除模拟数据生成函数,当配置加载失败时显示空列表而非错误数据,提高用户体验
This commit is contained in:
parent
81d404761a
commit
05fea676b9
3 changed files with 4 additions and 70 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
2.10.6
|
2.10.6.1
|
||||||
|
|
|
||||||
|
|
@ -493,10 +493,8 @@ async function loadConfigList(searchTerm = '', statusFilter = '', providerFilter
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载配置列表失败:', error);
|
console.error('加载配置列表失败:', error);
|
||||||
showToast(t('common.error'), t('common.error') + ': ' + error.message, 'error');
|
showToast(t('common.error'), t('common.error') + ': ' + error.message, 'error');
|
||||||
|
allConfigs = [];
|
||||||
// 使用模拟数据作为示例
|
filteredConfigs = [];
|
||||||
allConfigs = sortConfigs(generateMockConfigData());
|
|
||||||
filteredConfigs = [...allConfigs];
|
|
||||||
renderConfigList();
|
renderConfigList();
|
||||||
updateStats();
|
updateStats();
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -505,70 +503,6 @@ async function loadConfigList(searchTerm = '', statusFilter = '', providerFilter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成模拟配置数据(用于演示)
|
|
||||||
* @returns {Array} 模拟配置数据
|
|
||||||
*/
|
|
||||||
function generateMockConfigData() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
name: 'provider_pools.json',
|
|
||||||
path: './configs/provider_pools.json',
|
|
||||||
type: 'provider-pool',
|
|
||||||
size: 2048,
|
|
||||||
modified: '2025-11-11T04:30:00.000Z',
|
|
||||||
isUsed: true,
|
|
||||||
content: JSON.stringify({
|
|
||||||
"gemini-cli-oauth": [
|
|
||||||
{
|
|
||||||
"GEMINI_OAUTH_CREDS_FILE_PATH": "~/.gemini/oauth/creds.json",
|
|
||||||
"PROJECT_ID": "test-project"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}, null, 2)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'config.json',
|
|
||||||
path: './configs/config.json',
|
|
||||||
type: 'other',
|
|
||||||
size: 1024,
|
|
||||||
modified: '2025-11-10T12:00:00.000Z',
|
|
||||||
isUsed: true,
|
|
||||||
content: JSON.stringify({
|
|
||||||
"REQUIRED_API_KEY": "123456",
|
|
||||||
"SERVER_PORT": 3000
|
|
||||||
}, null, 2)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'oauth_creds.json',
|
|
||||||
path: '~/.gemini/oauth/creds.json',
|
|
||||||
type: 'oauth',
|
|
||||||
size: 512,
|
|
||||||
modified: '2025-11-09T08:30:00.000Z',
|
|
||||||
isUsed: false,
|
|
||||||
content: '{"client_id": "test", "client_secret": "test"}'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'input_system_prompt.txt',
|
|
||||||
path: './configs/input_system_prompt.txt',
|
|
||||||
type: 'system-prompt',
|
|
||||||
size: 256,
|
|
||||||
modified: '2025-11-08T15:20:00.000Z',
|
|
||||||
isUsed: true,
|
|
||||||
content: '你是一个有用的AI助手...'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'invalid_config.json',
|
|
||||||
path: './invalid_config.json',
|
|
||||||
type: 'other',
|
|
||||||
size: 128,
|
|
||||||
modified: '2025-11-07T10:15:00.000Z',
|
|
||||||
isUsed: false,
|
|
||||||
content: '{"invalid": json}'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看配置
|
* 查看配置
|
||||||
* @param {string} path - 文件路径
|
* @param {string} path - 文件路径
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<p>© 2025 AIClient2API. All rights reserved.</p>
|
<p>© 2077 AIClient2API. All rights reserved.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue