koishi-plugin-aka-ai-generator 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +8 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -808,7 +808,6 @@ var GeminiProvider = class {
|
|
|
808
808
|
const requestData = {
|
|
809
809
|
contents: [
|
|
810
810
|
{
|
|
811
|
-
role: "user",
|
|
812
811
|
parts: [
|
|
813
812
|
{ text: prompt },
|
|
814
813
|
...imageParts
|
|
@@ -838,8 +837,7 @@ var GeminiProvider = class {
|
|
|
838
837
|
requestData,
|
|
839
838
|
{
|
|
840
839
|
headers: {
|
|
841
|
-
"Content-Type": "application/json"
|
|
842
|
-
"X-Goog-Api-Key": this.config.apiKey
|
|
840
|
+
"Content-Type": "application/json"
|
|
843
841
|
},
|
|
844
842
|
params: {
|
|
845
843
|
key: this.config.apiKey
|
|
@@ -868,7 +866,8 @@ var GeminiProvider = class {
|
|
|
868
866
|
status: error?.response?.status,
|
|
869
867
|
statusText: error?.response?.statusText,
|
|
870
868
|
current: i + 1,
|
|
871
|
-
total: numImages
|
|
869
|
+
total: numImages,
|
|
870
|
+
errorType: error?.name || error?.constructor?.name || "Unknown"
|
|
872
871
|
};
|
|
873
872
|
if (error?.response?.data) {
|
|
874
873
|
try {
|
|
@@ -881,6 +880,11 @@ var GeminiProvider = class {
|
|
|
881
880
|
if (error?.config) {
|
|
882
881
|
errorDetails.url = error.config.url ? sanitizeUrl(error.config.url) : void 0;
|
|
883
882
|
errorDetails.method = error.config.method;
|
|
883
|
+
errorDetails.hasData = !!error.config.data;
|
|
884
|
+
}
|
|
885
|
+
if (error?.code === "ECONNREFUSED" || error?.code === "ETIMEDOUT" || error?.code === "ENOTFOUND") {
|
|
886
|
+
errorDetails.networkError = true;
|
|
887
|
+
errorDetails.networkErrorCode = error.code;
|
|
884
888
|
}
|
|
885
889
|
logger.error("Gemini API 调用失败", errorDetails);
|
|
886
890
|
if (allImages.length > 0) {
|