refactor(langfuse/chatapp):#346
Closed
desmonna wants to merge 1 commit into
Closed
Conversation
- 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
There was a problem hiding this comment.
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_logmonkey-patch signature inplugins/langfuse_tracing.pyby adding/passing thelog_pathparameter. - Ensures
frontends/chatapp_common.pycan import top-level modules (e.g.,agentmain) by inserting the project root intosys.pathearly.
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) |
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. |
Contributor
Author
|
好的,已修改后重新推送 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix 1: _patched_log function signature mismatch
Fix 2: Agentmain module import failed