refactor(langfuse/chatapp):

- Fix 1: _patched_log function signature mismatch
  - Location: plugins-langfuse_tracing.py
  - Problem: monkey-patch function only accepts 2 parameters, but the original function has 3 parameters (including the default parameter log_path)
  - Fix: add log_path=None parameter and pass it to the original function
- Fix 2: Agentmain module import failure
  - Location: frontends-chatapp_common.py
  - Problem: frontends directory cannot be imported into the agentmain of the upper directory
  - Fix: Add the parent directory to sys.path at the beginning of the file
This commit is contained in:
desmonna committed 2026-05-14 22:46:06 +08:00
1 parent 3b5faedd99
commit 8b2cb65166
2 files changed
+7 -2

No files matched your search

+2 -2
View File
@@ -20,7 +20,7 @@ if _lf:
_tls = threading.local()
_orig_log = llmcore._write_llm_log
def _patched_log(label, content):
def _patched_log(label, content, log_path=None):
try:
if label == 'Prompt':
_tls.gen = _lf.start_observation(name='llm.chat', as_type='generation', input=content[:20000])
@@ -29,7 +29,7 @@ if _lf:
_tls.gen.update(output=content[:20000], usage_details=getattr(_tls, 'usage', None))
_tls.gen.end(); _tls.gen = None
except Exception: pass
return _orig_log(label, content)
return _orig_log(label, content, log_path)
llmcore._write_llm_log = _patched_log
def _extract_usage(buf):