Compare commits

...

2 Commits

Author SHA1 Message Date
hkfires
3a2d96725f fix(ui): align file-item footer and adjust badge spacing 2025-11-06 14:23:07 +08:00
Supra4E8C
8283e99909 fix(app.js):尝试修复codex配置异常丢失数据的问题 2025-11-05 18:06:22 +08:00
2 changed files with 51 additions and 14 deletions

48
app.js
View File

@@ -2315,6 +2315,30 @@ class CLIProxyManager {
.replace(/'/g, ''');
}
// 兼容服务端返回的数组结构
normalizeArrayResponse(data, key) {
if (Array.isArray(data)) {
return data;
}
if (data && Array.isArray(data[key])) {
return data[key];
}
if (data && Array.isArray(data.items)) {
return data.items;
}
return [];
}
// 构造Codex配置保持未展示的字段
buildCodexConfig(apiKey, baseUrl, proxyUrl, original = {}) {
return {
...original,
'api-key': apiKey,
'base-url': baseUrl || '',
'proxy-url': proxyUrl || ''
};
}
// 显示添加API密钥模态框
showAddApiKeyModal() {
const modal = document.getElementById('modal');
@@ -2695,15 +2719,9 @@ class CLIProxyManager {
try {
const data = await this.makeRequest('/codex-api-key');
const currentKeys = data['codex-api-key'] || [];
const currentKeys = this.normalizeArrayResponse(data, 'codex-api-key').map(item => ({ ...item }));
const newConfig = { 'api-key': apiKey };
if (baseUrl) {
newConfig['base-url'] = baseUrl;
}
if (proxyUrl) {
newConfig['proxy-url'] = proxyUrl;
}
const newConfig = this.buildCodexConfig(apiKey, baseUrl, proxyUrl);
currentKeys.push(newConfig);
@@ -2761,14 +2779,16 @@ class CLIProxyManager {
}
try {
const newConfig = { 'api-key': apiKey };
if (baseUrl) {
newConfig['base-url'] = baseUrl;
}
if (proxyUrl) {
newConfig['proxy-url'] = proxyUrl;
const listResponse = await this.makeRequest('/codex-api-key');
const currentList = this.normalizeArrayResponse(listResponse, 'codex-api-key');
if (!Array.isArray(currentList) || index < 0 || index >= currentList.length) {
throw new Error('Invalid codex configuration index');
}
const original = currentList[index] ? { ...currentList[index] } : {};
const newConfig = this.buildCodexConfig(apiKey, baseUrl, proxyUrl, original);
await this.makeRequest('/codex-api-key', {
method: 'PATCH',
body: JSON.stringify({ index, value: newConfig })

View File

@@ -1751,6 +1751,22 @@ input:checked+.slider:before {
justify-content: flex-end;
}
/* 认证文件项的底部布局优化 - 确保状态标签和操作按钮垂直对齐 */
.file-item .item-footer {
align-items: center; /* 垂直居中对齐 */
gap: 12px; /* 增加状态标签和按钮之间的间距 */
}
.file-item .item-stats {
align-items: center; /* 状态徽章垂直居中 */
margin: 0; /* 移除默认外边距 */
}
.file-item .item-actions {
align-items: center; /* 操作按钮垂直居中 */
gap: 6px; /* 按钮之间适当间距 */
}
/* API Keys 和 AI Providers 的按钮组 - 绝对定位到右侧垂直居中 */
.key-item .item-actions,
.provider-item .item-actions {
@@ -3642,6 +3658,7 @@ input:checked+.slider:before {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-top: 8px;
}
/* 统计徽章基础样式 */