Skip to content

refactor(langfuse/chatapp):#346

Closed
desmonna wants to merge 1 commit into
lsdefine:mainfrom
desmonna:main
Closed

refactor(langfuse/chatapp):#346
desmonna wants to merge 1 commit into
lsdefine:mainfrom
desmonna:main

Conversation

@desmonna
Copy link
Copy Markdown
Contributor

  • 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 failed

    • Location: frontends-chatapp_common.py
    • Problem: Modules in the 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

- 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 failed
  - Location: frontends-chatapp_common.py
  - Problem: Modules in the 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
Copilot AI review requested due to automatic review settings May 12, 2026 06:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses two runtime issues related to optional Langfuse tracing and frontend module imports in the chatapp frontend utilities.

Changes:

  • Fixes the llmcore._write_llm_log monkey-patch signature in plugins/langfuse_tracing.py by adding/passing the log_path parameter.
  • Ensures frontends/chatapp_common.py can import top-level modules (e.g., agentmain) by inserting the project root into sys.path early.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plugins/langfuse_tracing.py Aligns patched logger signature with llmcore._write_llm_log(..., log_path=None) and forwards log_path.
frontends/chatapp_common.py Adds project-root sys.path bootstrap to prevent agentmain import failures in some execution contexts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +6
# 确保能导入上级目录的模块(如 agentmain)
_parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if _parent_dir not in sys.path:
sys.path.insert(0, _parent_dir)
@lsdefine
Copy link
Copy Markdown
Owner

Thank you for your contribution! This PR modifies 2 files, but the core files are changed by 209% and 173% respectively — effectively complete rewrites. Changes of this magnitude to core files cannot be reviewed safely in a single PR and violate our impact-radius requirements. Please break this into incremental changes and resubmit.

@lsdefine lsdefine closed this May 14, 2026
@desmonna
Copy link
Copy Markdown
Contributor Author

好的,已修改后重新推送

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants