解决超出上下文后导致错误禁用token的bug
Browse files- src/api/client.js +3 -0
src/api/client.js
CHANGED
|
@@ -76,6 +76,9 @@ async function handleApiError(error, token) {
|
|
| 76 |
}
|
| 77 |
|
| 78 |
if (status === 403) {
|
|
|
|
|
|
|
|
|
|
| 79 |
tokenManager.disableCurrentToken(token);
|
| 80 |
throw new Error(`该账号没有使用权限,已自动禁用。错误详情: ${errorBody}`);
|
| 81 |
}
|
|
|
|
| 76 |
}
|
| 77 |
|
| 78 |
if (status === 403) {
|
| 79 |
+
if (JSON.stringify(errorBody).includes("The caller does not")){
|
| 80 |
+
throw new Error(`超出模型最大上下文。错误详情: ${errorBody}`);
|
| 81 |
+
}
|
| 82 |
tokenManager.disableCurrentToken(token);
|
| 83 |
throw new Error(`该账号没有使用权限,已自动禁用。错误详情: ${errorBody}`);
|
| 84 |
}
|