asemxin commited on
Commit
82dc502
·
1 Parent(s): 957c1e7

feat: 去掉图床上传,只保留 Vision 大师看图感悟

Browse files
Files changed (1) hide show
  1. image_daemon.py +7 -31
image_daemon.py CHANGED
@@ -208,39 +208,15 @@ def handle_image_message(message_id, chat_id, image_key):
208
  if not img_data:
209
  return
210
 
211
- log(f"📥 {len(img_data)} bytes, 上传+分析中...")
212
 
213
- # 并行:Vision分析 + 上传图床
214
- vision_result = [None]
215
- url_result = [None]
216
-
217
- def do_vision():
218
- vision_result[0] = analyze_image_with_vision(img_data)
219
-
220
- def do_upload():
221
- url_result[0] = upload_image(img_data)
222
-
223
- t1 = threading.Thread(target=do_vision)
224
- t2 = threading.Thread(target=do_upload)
225
- t1.start(); t2.start()
226
- t1.join(); t2.join()
227
-
228
- url = url_result[0]
229
- vision = vision_result[0]
230
-
231
- if url:
232
- log(f"✅ {url}")
233
- if vision:
234
- reply = f"✅ 图片已转存:\n{url}\n\n{vision}"
235
- else:
236
- reply = f"✅ 图片已转存:\n{url}"
237
- result = send_text(token, chat_id, reply)
238
- log(f"📤 已发送 (code={result.get('code', '?')})")
239
  else:
240
- path = f"/tmp/{image_key[:30]}.jpg"
241
- with open(path, "wb") as f:
242
- f.write(img_data)
243
- log(f"⚠️ 图床全部失败,本地保存: {path}")
244
 
245
  # ---------- SOUL.md 加载 ----------
246
  def load_soul():
 
208
  if not img_data:
209
  return
210
 
211
+ log(f"📥 {len(img_data)} bytes, Vision 分析中...")
212
 
213
+ # 调用 Vision 分析
214
+ vision = analyze_image_with_vision(img_data)
215
+ if vision:
216
+ result = send_text(token, chat_id, vision)
217
+ log(f"📤 已发送感悟 (code={result.get('code', '?')})")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  else:
219
+ log("⚠️ Vision 分析失败,无回复")
 
 
 
220
 
221
  # ---------- SOUL.md 加载 ----------
222
  def load_soul():