From feb7a63112a69c356e6db44c9ce116c4a20636af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 00:44:51 +0000 Subject: [PATCH 1/6] Use relative paths in scripts --- build.py | 4 ++-- query.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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..60ecbdd 100644 --- a/query.py +++ b/query.py @@ -169,7 +169,7 @@ 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") + out = a.out or os.path.join(".", filename or f"media_{a.msg_id}.bin") with open(out, "wb") as f: f.write(blob) print(f"已导出: {out} ({len(blob):,} 字节)") From 94aeea92e7cfa3b9ceb6426d0bf453fd533b6980 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 00:45:45 +0000 Subject: [PATCH 2/6] Default media export to relative tmp dir --- query.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/query.py b/query.py index 60ecbdd..97314e4 100644 --- a/query.py +++ b/query.py @@ -169,7 +169,11 @@ def cmd_media(a): if not row: print(f"消息 #{a.msg_id} 没有已入库的媒体。"); return filename, blob = row - out = a.out or os.path.join(".", filename or f"media_{a.msg_id}.bin") + if a.out: + out = a.out + else: + os.makedirs("tmp", exist_ok=True) + out = os.path.join("tmp", filename or f"media_{a.msg_id}.bin") with open(out, "wb") as f: f.write(blob) print(f"已导出: {out} ({len(blob):,} 字节)") From 525de99060f29361147bcfa508b831f5dc787972 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 00:46:30 +0000 Subject: [PATCH 3/6] Simplify default media output path logic --- query.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/query.py b/query.py index 97314e4..c3529d8 100644 --- a/query.py +++ b/query.py @@ -169,11 +169,8 @@ def cmd_media(a): if not row: print(f"消息 #{a.msg_id} 没有已入库的媒体。"); return filename, blob = row - if a.out: - out = a.out - else: - os.makedirs("tmp", exist_ok=True) - out = os.path.join("tmp", filename or f"media_{a.msg_id}.bin") + os.makedirs("tmp", exist_ok=True) + out = a.out or os.path.join("tmp", filename or f"media_{a.msg_id}.bin") with open(out, "wb") as f: f.write(blob) print(f"已导出: {out} ({len(blob):,} 字节)") From 2fe88d5be7a14901bf14610b670d0e6c7d6f000e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 00:47:29 +0000 Subject: [PATCH 4/6] Initialize relative tmp directory in query startup --- query.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/query.py b/query.py index c3529d8..178f426 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,13 +171,13 @@ def cmd_media(a): if not row: print(f"消息 #{a.msg_id} 没有已入库的媒体。"); return filename, blob = row - os.makedirs("tmp", exist_ok=True) - out = a.out or os.path.join("tmp", filename or f"media_{a.msg_id}.bin") + 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):,} 字节)") def main(): + os.makedirs(TMP_DIR, exist_ok=True) ap = argparse.ArgumentParser(description="群聊库检索") sub = ap.add_subparsers(dest="cmd", required=True) def add_filters(p): From d3fe79785dad61290a3070dc846fb45ffb97b0e9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 00:48:16 +0000 Subject: [PATCH 5/6] Ensure tmp export path exists when media command runs --- query.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/query.py b/query.py index 178f426..55e98e0 100644 --- a/query.py +++ b/query.py @@ -171,6 +171,8 @@ def cmd_media(a): if not row: print(f"消息 #{a.msg_id} 没有已入库的媒体。"); return filename, blob = row + 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):,} 字节)") From 6db1e78b75ffab1ee975853729b9f64443ec8885 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 00:49:01 +0000 Subject: [PATCH 6/6] Create tmp dir only when media export needs it --- query.py | 1 - 1 file changed, 1 deletion(-) diff --git a/query.py b/query.py index 55e98e0..7b5a028 100644 --- a/query.py +++ b/query.py @@ -179,7 +179,6 @@ def cmd_media(a): def main(): - os.makedirs(TMP_DIR, exist_ok=True) ap = argparse.ArgumentParser(description="群聊库检索") sub = ap.add_subparsers(dest="cmd", required=True) def add_filters(p):