mioku-plugin-chat 2.9.10 → 2.9.11

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.
@@ -157,7 +157,7 @@ export async function processImage(
157
157
 
158
158
  const record: ImageRecord = {
159
159
  hash,
160
- url: normalizeImageUrl(imageUrl) || imageUrl,
160
+ url: imageUrl,
161
161
  type: "image",
162
162
  description: analysis.description || "未知",
163
163
  createdAt: Date.now(),
@@ -177,17 +177,11 @@ export async function getImageTag(
177
177
  const exact = db.getImageByUrl(imageUrl);
178
178
  if (exact) return `[image:${exact.description}]`;
179
179
 
180
- const normalized = normalizeImageUrl(imageUrl);
181
- if (normalized && normalized !== imageUrl) {
182
- const normalizedHit = db.getImageByUrl(normalized);
183
- if (normalizedHit) return `[image:${normalizedHit.description}]`;
184
- }
185
-
186
180
  const hash = await calculateImageHash(imageUrl);
187
181
  if (hash) {
188
182
  const byHash = db.getImageByHash(hash);
189
183
  if (byHash) {
190
- db.saveImage(asImageRecord(byHash, normalized || imageUrl));
184
+ db.saveImage(asImageRecord(byHash, imageUrl));
191
185
  return `[image:${byHash.description}]`;
192
186
  }
193
187
  }
@@ -198,7 +192,7 @@ export async function getImageTag(
198
192
  function asImageRecord(record: ImageRecord, url: string): ImageRecord {
199
193
  return {
200
194
  ...record,
201
- url: normalizeImageUrl(url) || url,
195
+ url,
202
196
  type: "image",
203
197
  };
204
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mioku-plugin-chat",
3
- "version": "2.9.10",
3
+ "version": "2.9.11",
4
4
  "description": "AI 智能聊天插件",
5
5
  "main": "index.ts",
6
6
  "type": "module",
package/utils/message.ts CHANGED
@@ -14,10 +14,7 @@ import {
14
14
  type HistoryMediaProcessingOptions,
15
15
  type MediaMessageSegment,
16
16
  } from "../core/media/history-media";
17
- import {
18
- calculateImageHash,
19
- normalizeImageUrl,
20
- } from "../core/media/image-analyzer";
17
+ import { calculateImageHash } from "../core/media/image-analyzer";
21
18
 
22
19
  const HISTORY_MEDIA_CONCURRENCY = 8;
23
20
 
@@ -310,12 +307,6 @@ async function getImageTagWithHashCache(
310
307
  const exact = db.getImageByUrl?.(imageUrl);
311
308
  if (exact) return `[image:${exact.description}]`;
312
309
 
313
- const normalized = normalizeImageUrl(imageUrl);
314
- if (normalized && normalized !== imageUrl) {
315
- const hit = db.getImageByUrl?.(normalized);
316
- if (hit) return `[image:${hit.description}]`;
317
- }
318
-
319
310
  let hash = ctx.hashLookupCache.get(`hash:${imageUrl}`);
320
311
  if (hash === undefined) {
321
312
  hash = (await calculateImageHash(imageUrl)) || null;
@@ -328,7 +319,7 @@ async function getImageTagWithHashCache(
328
319
  try {
329
320
  db.saveImage?.({
330
321
  hash: byHash.hash,
331
- url: normalized || imageUrl,
322
+ url: imageUrl,
332
323
  type: "image",
333
324
  description: byHash.description,
334
325
  createdAt: byHash.createdAt,