fix: use auth_index field from API response for auth file mapping

- API returns 'auth_index' not 'authIndex'
- Support both field names for compatibility
- Properly map hash-based auth_index to file name
This commit is contained in:
Lany798
2026-02-03 08:57:51 +08:00
parent 259bf88f81
commit ee60be6f0a

View File

@@ -135,8 +135,13 @@ export function RequestLogs({ data, loading: parentLoading, providerMap, provide
const files = response?.files || [];
const map: Record<string, string> = {};
files.forEach((file) => {
if (file.authIndex !== undefined && file.authIndex !== null) {
map[String(file.authIndex)] = file.name;
// 兼容 auth_index 和 authIndex 两种字段名API 返回的是 auth_index
const rawAuthIndex = (file as Record<string, unknown>)['auth_index'] ?? file.authIndex;
if (rawAuthIndex !== undefined && rawAuthIndex !== null) {
const authIndexKey = String(rawAuthIndex).trim();
if (authIndexKey) {
map[authIndexKey] = file.name;
}
}
});
setAuthIndexMap(map);