refactor: plugins dir + opt-in langfuse via __getattr__ guard

- mv langfuse_tracing.py -> plugins/langfuse_tracing.py
- llmcore: load plugin lazily inside __getattr__ when langfuse_config present
  (PEP 562 module __getattr__ naturally fires only once after globals().update)
- llmcore: extract _record_usage() from 4 scattered [Cache] print sites
- agentmain: /resume scans only latest 10 files
This commit is contained in:
Jiaqing Liang
2026-04-20 15:56:06 +08:00
parent 8e6270e3a3
commit 116d7d3d23
3 changed files with 26 additions and 24 deletions

View File

@@ -111,7 +111,7 @@ class GeneraticAgent:
display_queue.put({'done': smart_format(f"✅ session.{k} = {repr(v)}", max_str_len=500), 'source': 'system'})
return None
if raw_query.strip() == '/resume':
return r'用re.findall(r"<history>\\n\[(?:USER\|Agent)\].*?</history>", content, re.DOTALL) 扫temp/model_responses/下文件(除本PID),取每文件最后一个匹配(注意JSON里换行是字面\\n)作为该会话内容按mtime倒序每个用一句话总结聊了什么让我选择选定后再简单读该文件末尾作为聊天基础'
return r'用re.findall(r"<history>\\n\[(?:USER\|Agent)\].*?</history>", content, re.DOTALL) 扫temp/model_responses/下时间最近的10个文件(除本PID),取每文件最后一个匹配(注意JSON里换行是字面\\n)作为该会话内容按mtime倒序每个用一句话总结聊了什么让我选择选定后再简单读该文件末尾作为聊天基础'
return raw_query
def run(self):