diff --git a/build.py b/build.py index 273907c..c8246d7 100644 --- a/build.py +++ b/build.py @@ -8,8 +8,8 @@ """ import os, sys, json, time, hashlib, sqlite3 -BASE = "/Users/yusteven/Desktop/weflow/source" -DB = "/Users/yusteven/Desktop/weflow/chat.db" +BASE = "source" +DB = "chat.db" EMBED_TYPES = {"文本消息", "引用消息", "聊天记录"} # 进语义层的类型 MODEL_NAME, DIM, MAX_SEQ = "BAAI/bge-m3", 1024, 512 diff --git a/query.py b/query.py index 93c9718..7b5a028 100644 --- a/query.py +++ b/query.py @@ -16,6 +16,8 @@ import sys, os, argparse, sqlite3, datetime import build +TMP_DIR = "tmp" + def con(): return sqlite3.connect(build.DB) @@ -169,7 +171,9 @@ def cmd_media(a): if not row: print(f"消息 #{a.msg_id} 没有已入库的媒体。"); return filename, blob = row - out = a.out or os.path.join("/tmp", filename or f"media_{a.msg_id}.bin") + if not a.out: + os.makedirs(TMP_DIR, exist_ok=True) + out = a.out or os.path.join(TMP_DIR, filename or f"media_{a.msg_id}.bin") with open(out, "wb") as f: f.write(blob) print(f"已导出: {out} ({len(blob):,} 字节)")