-
Notifications
You must be signed in to change notification settings - Fork 23
Add feature: Interactive steps for each claim and its body text #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add feature: Interactive steps for each claim and its body text #20
Conversation
WalkthroughThe code introduces a helper function to map verdict texts to emoji-labeled verdict strings. It modifies the way progress and verdict results are displayed by using asynchronous steps for each claim-verdict pair, updating their outputs individually. Minor formatting changes are made to progress messages and evidence presentation. Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app.py (1)
8-18
: Add docstring to the helper function.The
get_verdict_value
function logic is correct and provides a clean mapping from verdict text to emoji-labeled strings. However, it's missing a docstring as flagged by static analysis.def get_verdict_value(verdict_text): + """Map verdict text to emoji-labeled verdict string. + + Args: + verdict_text (str): The raw verdict text ("true", "partially true", "false", etc.) + + Returns: + str: Emoji-labeled verdict string + """ match verdict_text:🧰 Tools
🪛 Ruff (0.11.9)
8-8: Missing docstring in public function
(D103)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app.py
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
app.py (1)
src/verifact_manager.py (1)
VerifactManager
(37-187)
🪛 Ruff (0.11.9)
app.py
1-1: pandas
imported but unused
Remove unused import: pandas
(F401)
8-8: Missing docstring in public function
(D103)
20-20: Missing docstring in public function
(D103)
46-46: Blank line contains whitespace
Remove whitespace from blank line
(W293)
58-58: Blank line contains whitespace
Remove whitespace from blank line
(W293)
68-68: Blank line contains whitespace
Remove whitespace from blank line
(W293)
71-71: Blank line contains whitespace
Remove whitespace from blank line
(W293)
77-77: Missing docstring in public function
(D103)
🪛 GitHub Check: Codacy Static Code Analysis
app.py
[warning] 1-1: app.py#L1
Unused pandas imported as pd
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (4)
app.py (4)
21-21
: Minor formatting improvement looks good.The change from "Starting fact-checking pipeline..." to "Starting fact-checking pipeline:" provides better visual consistency when progress updates are appended.
27-27
: Progress separator improvement enhances readability.The addition of the em dash (" —") separator makes the progress updates more visually distinct and readable.
45-71
: Excellent improvement to user experience with interactive steps.The refactoring from a single accumulated response to individual async steps for each claim significantly improves the user interface by:
- Making each claim-verdict pair interactive and expandable
- Providing clear visual separation between claims
- Using the
get_verdict_value
helper to display emoji-labeled verdicts in step titlesThe implementation correctly handles the evidence formatting and maintains all the original information display while enhancing the presentation.
However, there are some formatting issues to clean up:
- - claim_title = f"Claim {idx+1}: {claim_text} \u2014 Verdict: {get_verdict_value(verdict_text)}" - async with cl.Step(name=claim_title, type="system") as step: # Evidence formatting if evidence: evidence_str = "\n".join([ f"- {getattr(ev, 'content', str(ev))} (Source: {getattr(ev, 'source', 'N/A')}, Stance: {getattr(ev, 'stance', 'N/A')}, Relevance: {getattr(ev, 'relevance', 'N/A')})" for ev in evidence ]) else: evidence_str = "No evidence found." - step.output = ( f"\n---\n**Claim {idx+1}:** {claim_text}\n" f"**Evidence:**\n{evidence_str}\n" f"\n**Verdict:** {verdict_text}\n" f"**Confidence:** {confidence}\n" f"**Explanation:** {explanation}\n" f"**Sources:**\n{sources_str}\n" ) await step.update() - progress_msg.content = "" await progress_msg.update() -🧰 Tools
🪛 Ruff (0.11.9)
46-46: Blank line contains whitespace
Remove whitespace from blank line
(W293)
58-58: Blank line contains whitespace
Remove whitespace from blank line
(W293)
68-68: Blank line contains whitespace
Remove whitespace from blank line
(W293)
71-71: Blank line contains whitespace
Remove whitespace from blank line
(W293)
78-78
: Welcome message enhancement looks good.The emoji addition makes the welcome message more friendly and visually appealing.
@@ -1,18 +1,30 @@ | |||
import pandas as pd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import.
The pandas
import is not used anywhere in the file and should be removed to clean up the codebase.
-import pandas as pd
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import pandas as pd | |
// (The import `pandas as pd` has been removed; no further changes needed here.) |
🧰 Tools
🪛 Ruff (0.11.9)
1-1: pandas
imported but unused
Remove unused import: pandas
(F401)
🪛 GitHub Check: Codacy Static Code Analysis
[warning] 1-1: app.py#L1
Unused pandas imported as pd
🤖 Prompt for AI Agents
In app.py at line 1, the pandas import is unused and should be removed to clean
up the code. Delete the line importing pandas from the file.
Issue #4
Summary by CodeRabbit
New Features
Style
Chores