diff --git a/scripts/daemon.py b/scripts/daemon.py index 6839eca6..019cd52b 100755 --- a/scripts/daemon.py +++ b/scripts/daemon.py @@ -67,6 +67,8 @@ FAST_MODEL = "stepfun-ai/step-3.5-flash" DEEP_MODEL = "mistralai/mistral-large-3-675b-instruct-2512" FEISHU_WEBHOOK = "https://open.feishu.cn/open-apis/bot/v2/hook/446db983-e392-4d2c-bfb8-f9060e5df3ad" +API = "http://127.0.0.1:3000/v1" # NewAPI gateway + _stop_event = threading.Event() # Lazy-loaded soulful modules (avoid import at module load time) diff --git a/scripts/os_sense.py b/scripts/os_sense.py index da35fcc3..1ff12e92 100644 --- a/scripts/os_sense.py +++ b/scripts/os_sense.py @@ -73,10 +73,12 @@ def get_journal_keywords(n=50): try: entry = json.loads(line) text = entry.get("summary", "") + " " + entry.get("action_taken", "") - # 简单分词 + # 简单分词(英文)+ 中文词提取(\w 不匹配中文) tokens = re.findall(r'[\w]{2,}', text.lower()) + chinese_words = re.findall(r'[\u4e00-\u9fff]{2,}', text) tokens = [t for t in tokens if t not in STOPWORDS and len(t) > 1] - words.extend(tokens) + chinese_words = [w for w in chinese_words if w not in STOPWORDS] + words.extend(tokens + chinese_words) except: pass except: diff --git a/scripts/soulful_core.py b/scripts/soulful_core.py index ac501382..0768eb1e 100644 --- a/scripts/soulful_core.py +++ b/scripts/soulful_core.py @@ -341,7 +341,7 @@ if __name__ == "__main__": p = argparse.ArgumentParser(description="心迹记录") p.add_argument("content") p.add_argument("--tags", nargs="+", default=[]) - p.add_argument("--type", "-t", default="moment", choices=["moment", "signal", "reflection"]) + p.add_argument("-t", "--type", default="moment", choices=["moment", "signal", "reflection"]) p.add_argument("--importance", "-i", type=int, default=3) args = p.parse_args(sys.argv[2:]) ht = HeartTraces() @@ -396,12 +396,12 @@ if __name__ == "__main__": "cq-list": cmd_cq_list, } - if len(sys.argv) < 2 or sys.argv[1] not in commands: - print("用法: soulful_core.py [args]") - print("命令:", list(commands.keys())) - sys.exit(1) - - commands[sys.argv[1]]() + if __name__ == "__main__": + if len(sys.argv) < 2 or sys.argv[1] not in commands: + print("用法: soulful_core.py [args]") + print("命令:", list(commands.keys())) + sys.exit(1) + commands[sys.argv[1]]() # ====== 会话接口:供小唯在对话中调用 ====== @@ -442,8 +442,4 @@ def summarize(): for c in cares_pending[:3]: lines.append(f" → {c['content'][:50]}") - return "\n".join(lines) - - -if __name__ == "__main__": - main() \ No newline at end of file + return "\n".join(lines) \ No newline at end of file diff --git a/soulful/cares-queue.json b/soulful/cares-queue.json index 1f8ffb0d..2b0336dd 100644 --- a/soulful/cares-queue.json +++ b/soulful/cares-queue.json @@ -1,16 +1,5 @@ { "cares": [ - { - "id": "41280638", - "content": "记得同步文档到Obsidian", - "context": "牧尘提到", - "created_at": "2026-07-09T09:50:58.779920+00:00", - "follow_up_date": "2026-07-10", - "status": "pending", - "reminder_count": 0, - "last_reminded": null, - "tags": [] - }, { "id": "5a1465eb", "content": "记得测试牵挂功能", @@ -18,8 +7,8 @@ "created_at": "2026-07-09T09:51:04.369800+00:00", "follow_up_date": "2026-07-09", "status": "pending", - "reminder_count": 2, - "last_reminded": "2026-07-09T14:55:05.935006+00:00", + "reminder_count": 4, + "last_reminded": "2026-07-09T17:01:01.292270+00:00", "tags": [] }, { @@ -34,5 +23,5 @@ "tags": [] } ], - "updated_at": "2026-07-09T14:55:05.935055+00:00" + "updated_at": "2026-07-09T17:01:01.292324+00:00" } \ No newline at end of file diff --git a/soulful/heart-traces.jsonl b/soulful/heart-traces.jsonl index 2dd5fc76..865009e4 100644 --- a/soulful/heart-traces.jsonl +++ b/soulful/heart-traces.jsonl @@ -1,2 +1 @@ -{"id": "eabf352f", "timestamp": "2026-07-09T09:50:50.730036+00:00", "session_id": "default", "type": "moment", "content": "我们一起修好了织忆", "tags": ["成长"], "importance": 5} {"id": "d945a6aa", "timestamp": "2026-07-09T13:29:22.581218+00:00", "session_id": "default", "type": "moment", "content": "我们一起修好了织忆", "tags": ["成长", "织忆"], "importance": 5}