koishi-plugin-aka-ai-generator 0.6.12 → 0.6.13

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.
Files changed (2) hide show
  1. package/lib/index.js +30 -32
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1827,12 +1827,26 @@ ${infoParts.join("\n")}`;
1827
1827
  index,
1828
1828
  total
1829
1829
  });
1830
+ logger.info("准备发送图片", { userId, index: index + 1, total, imageUrlLength: imageUrl?.length || 0 });
1831
+ try {
1832
+ await session.send(import_koishi2.h.image(imageUrl));
1833
+ logger.info("流式处理:图片已发送", { index: index + 1, total, userId });
1834
+ } catch (sendError) {
1835
+ logger.error("发送图片失败", {
1836
+ userId,
1837
+ error: sanitizeError(sendError),
1838
+ errorMessage: sendError?.message,
1839
+ index: index + 1,
1840
+ total
1841
+ });
1842
+ throw sendError;
1843
+ }
1830
1844
  if (!creditDeducted && generatedImages.length > 0) {
1831
1845
  creditDeducted = true;
1832
1846
  logger.info("准备扣除积分", { userId, totalImages: total, currentIndex: index });
1833
1847
  try {
1834
1848
  await recordUserUsage(session, styleName, total, false);
1835
- logger.info("流式处理:第一张图片生成,积分已扣除", {
1849
+ logger.info("流式处理:积分已扣除", {
1836
1850
  userId,
1837
1851
  totalImages: total,
1838
1852
  currentIndex: index
@@ -1843,23 +1857,8 @@ ${infoParts.join("\n")}`;
1843
1857
  error: sanitizeError(creditError),
1844
1858
  totalImages: total
1845
1859
  });
1846
- throw creditError;
1847
1860
  }
1848
1861
  }
1849
- logger.info("准备发送图片", { userId, index: index + 1, total, imageUrlLength: imageUrl?.length || 0 });
1850
- try {
1851
- await session.send(import_koishi2.h.image(imageUrl));
1852
- logger.info("流式处理:图片已发送", { index: index + 1, total, userId });
1853
- } catch (sendError) {
1854
- logger.error("发送图片失败", {
1855
- userId,
1856
- error: sanitizeError(sendError),
1857
- errorMessage: sendError?.message,
1858
- index: index + 1,
1859
- total
1860
- });
1861
- throw sendError;
1862
- }
1863
1862
  if (total > 1 && index < total - 1) {
1864
1863
  logger.debug("多张图片,添加延时", { index, total });
1865
1864
  await new Promise((resolve) => setTimeout(resolve, 1e3));
@@ -2061,12 +2060,26 @@ Prompt: ${prompt}`);
2061
2060
  index,
2062
2061
  total
2063
2062
  });
2063
+ logger.info("准备发送图片 (COMPOSE_IMAGE)", { userId, index: index + 1, total, imageUrlLength: imageUrl?.length || 0 });
2064
+ try {
2065
+ await session.send(import_koishi2.h.image(imageUrl));
2066
+ logger.info("流式处理:图片已发送 (COMPOSE_IMAGE)", { index: index + 1, total, userId });
2067
+ } catch (sendError) {
2068
+ logger.error("发送图片失败 (COMPOSE_IMAGE)", {
2069
+ userId,
2070
+ error: sanitizeError(sendError),
2071
+ errorMessage: sendError?.message,
2072
+ index: index + 1,
2073
+ total
2074
+ });
2075
+ throw sendError;
2076
+ }
2064
2077
  if (!creditDeducted && generatedImages.length > 0) {
2065
2078
  creditDeducted = true;
2066
2079
  logger.info("准备扣除积分 (COMPOSE_IMAGE)", { userId, totalImages: total, currentIndex: index });
2067
2080
  try {
2068
2081
  await recordUserUsage(session, COMMANDS.COMPOSE_IMAGE, total, false);
2069
- logger.info("流式处理:第一张图片生成,积分已扣除 (COMPOSE_IMAGE)", {
2082
+ logger.info("流式处理:积分已扣除 (COMPOSE_IMAGE)", {
2070
2083
  userId,
2071
2084
  totalImages: total,
2072
2085
  currentIndex: index
@@ -2077,23 +2090,8 @@ Prompt: ${prompt}`);
2077
2090
  error: sanitizeError(creditError),
2078
2091
  totalImages: total
2079
2092
  });
2080
- throw creditError;
2081
2093
  }
2082
2094
  }
2083
- logger.info("准备发送图片 (COMPOSE_IMAGE)", { userId, index: index + 1, total, imageUrlLength: imageUrl?.length || 0 });
2084
- try {
2085
- await session.send(import_koishi2.h.image(imageUrl));
2086
- logger.info("流式处理:图片已发送 (COMPOSE_IMAGE)", { index: index + 1, total, userId });
2087
- } catch (sendError) {
2088
- logger.error("发送图片失败 (COMPOSE_IMAGE)", {
2089
- userId,
2090
- error: sanitizeError(sendError),
2091
- errorMessage: sendError?.message,
2092
- index: index + 1,
2093
- total
2094
- });
2095
- throw sendError;
2096
- }
2097
2095
  if (total > 1 && index < total - 1) {
2098
2096
  logger.debug("多张图片,添加延时 (COMPOSE_IMAGE)", { index, total });
2099
2097
  await new Promise((resolve) => setTimeout(resolve, 1e3));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-aka-ai-generator",
3
3
  "description": "自用AI生成插件(GPTGod & Yunwu)",
4
- "version": "0.6.12",
4
+ "version": "0.6.13",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [