Skip to content

fix: wrong path to fonts#34

Merged
calebephrem merged 4 commits into
open-devhub:mainfrom
calebephrem:main
Jul 1, 2026
Merged

fix: wrong path to fonts#34
calebephrem merged 4 commits into
open-devhub:mainfrom
calebephrem:main

Conversation

@calebephrem

Copy link
Copy Markdown
Member

No description provided.

@devhub-bot devhub-bot Bot added the fix Bug fix label Jun 30, 2026
@beetle-ai

beetle-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary by Beetle

This PR fixes an incorrect font directory path in the visual card generation modules. The issue was that the path to the fonts directory was missing one level of directory traversal (..), causing the application to fail when attempting to load fonts for rendering stats and usage cards. This is a critical bug fix that ensures the visual components can properly locate and load the required font assets.

📁 File Changes Summary (Consolidated across all commits):

File Status Changes Description
src/visuals/statsCard.ts
src/visuals/usageCard.ts
Modified +2/-2 Fixed incorrect font directory path by adding an additional parent directory traversal (..) to correctly resolve the path from src/visuals/ to assets/fonts/. Changed from path.join(__dirname, "..", "assets", "fonts") to path.join(__dirname, "..", "..", "assets", "fonts")

Total Changes: 2 files changed, +2 additions, -2 deletions

🗺️ Walkthrough:

graph TD
A["Visual Card Modules (statsCard.ts, usageCard.ts)"]
B["Calculate __dirname (src/visuals/)"]
C["OLD PATH: ../assets/fonts"]
D["NEW PATH: ../../assets/fonts"]
E["Fonts Directory (assets/fonts/)"]
F["Font Registration Success"]
G["Font Loading Failure"]
A --> B
B --> C
B --> D
C -->|"Incorrect"| G
D -->|"Correct"| E
E --> F
N1["The old path resolved to src/assets/fonts (wrong)"]
N2["The new path resolves to assets/fonts (correct)"]
C -.-> N1
D -.-> N2
style C fill:#ffcccc
style D fill:#ccffcc
style G fill:#ff9999
style F fill:#99ff99
Loading

🎯 Key Changes:

  • Path Correction: Added an additional parent directory traversal (..) to the FONTS_DIR constant in both visual card modules
  • Root Cause: The modules are located at src/visuals/, requiring two levels up (../../) to reach the project root, then navigate to assets/fonts/
  • Impact: This fix ensures that font registration succeeds when the ensureFonts() function is called, preventing runtime errors in card generation
  • Consistency: Both statsCard.ts and usageCard.ts were updated identically, maintaining consistency across visual components

📊 Impact Assessment:

  • Security: ✅ No security implications. This is a path resolution fix that doesn't introduce any security vulnerabilities or expose sensitive data.
  • Performance: ✅ Neutral to positive impact. The fix enables proper font loading, which was previously failing. No performance degradation introduced; if anything, it prevents error handling overhead from failed font loads.
  • Maintainability: ✅ Improved maintainability. The fix corrects a fundamental path resolution issue that would have caused confusion and debugging overhead. The change is minimal, clear, and self-documenting. Consider adding a comment explaining the path structure for future developers.
  • Testing: ⚠️ Recommendation: This fix should be validated with integration tests that verify font loading succeeds in both development and production environments. Consider adding tests that:
  • Verify the FONTS_DIR path resolves correctly
  • Ensure ensureFonts() completes without errors
  • Validate that generated cards render with proper fonts
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

Follow us: Beetle · X · LinkedIn

@beetle-ai

beetle-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

✅ You're good to merge this PR! No issues found. Great job!

Settings
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

@devhub-bot

devhub-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Note

Linting checks passed successfully 🎉

All formatting and code quality checks are clean.

You're good to merge 🚀

@beetle-ai

beetle-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary by Beetle

This PR fixes a bug in the text formatting utility where em dashes (—) were not being properly replaced with hyphens when surrounded by spaces. The fix ensures that spaced em dashes are converted to spaced hyphens before falling back to the general em dash replacement, improving the consistency of text output formatting.

📁 File Changes Summary (Consolidated across all commits):

File Status Changes Description
src/utils/pretty.ts Modified +1/-1 Fixed em dash replacement logic to handle spaced em dashes () separately before general em dash conversion, preventing formatting inconsistencies in text output

Total Changes: 1 file changed, +1 addition, -1 deletion

🎯 Key Changes:

  • Enhanced em dash handling: Added explicit replacement for spaced em dashes () to spaced hyphens (-) before the general em dash-to-hyphen conversion
  • Improved text normalization: The chained replacement ensures that em dashes surrounded by spaces are preserved with proper spacing in the output
  • Bug fix: Resolves an issue where the previous single replacement pattern was likely causing incorrect formatting when em dashes appeared with surrounding whitespace

📊 Impact Assessment:

  • Security: ✅ No security implications. This is a pure string manipulation change with no external inputs or security-sensitive operations.
  • Performance: ✅ Negligible impact. Adds one additional string replacement operation, but the performance overhead is minimal for typical text processing workloads. The operations are still O(n) relative to input length.
  • Maintainability: ✅ Slightly improved. The chained replacement makes the intent clearer—handle the specific case (spaced em dash) before the general case (any em dash). Consider adding a comment explaining why both replacements are needed to prevent future regressions.
  • Testing: ⚠️ Recommendation: Add unit tests to cover edge cases:
  • Text with spaced em dashes: "hello — world""hello - world"
  • Text with unspaced em dashes: "hello—world""hello-world"
  • Text with multiple em dashes in various contexts
  • Ensure the fix doesn't break existing functionality with LaTeX-to-Unicode conversion
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

Follow us: Beetle · X · LinkedIn

@beetle-ai

beetle-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

✅ You're good to merge this PR! No issues found. Great job!

Settings
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

@devhub-bot

devhub-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Note

Linting checks passed successfully 🎉

All formatting and code quality checks are clean.

You're good to merge 🚀

@beetle-ai

beetle-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary by Beetle

This PR fixes a critical bug in the AI conversation system where vision support (image analysis) was broken when using conversation history. Previously, when a user sent an image with conversation context, the system would incorrectly pass only the text question instead of the complete content blocks (which include both text and image data), causing vision requests to fail or ignore the image. The fix ensures that when an image is present, the full content blocks are passed to the AI model, while text-only questions continue to work as before.

📁 File Changes Summary (Consolidated across all commits):

File Status Changes Description
src/commands/ai/askai.ts Modified +11/-2 Fixed vision support in conversation history by conditionally using contentBlocks (for image requests) or plain question text (for text-only requests) when constructing the messages array. Added logic to detect image presence and select appropriate content format before appending to conversation history.

Total Changes: 1 file changed, +11 additions, -2 deletions

🎯 Key Changes:

  • Conditional Content Handling: Introduced currentUserContent variable that dynamically selects between contentBlocks (structured content with images) and plain question text based on whether imageUrl is present
  • Vision Request Preservation: When imageUrl exists, the system now correctly passes the complete contentBlocks array containing both text and image data to the AI model
  • Backward Compatibility: Text-only conversations continue to work as before, using the simple string format for the question
  • Code Cleanup: Minor formatting improvements including whitespace normalization and comment ordering

📊 Impact Assessment:

  • Security: ✅ Neutral - No security implications. The change only affects how existing data is passed to the AI model without introducing new attack vectors or data exposure risks.
  • Performance: ✅ Neutral to Positive - Minimal performance impact. The conditional check (if (imageUrl)) is lightweight. Actually improves efficiency by preventing failed vision requests that would have occurred when images were incorrectly stripped from the conversation context.
  • Maintainability: ✅ Positive - The fix is clean and self-documenting. The variable name currentUserContent clearly indicates its purpose. The conditional logic is straightforward and easy to understand. Future developers will immediately understand why content format varies based on image presence.
  • Testing: ⚠️ Needs Attention - While the fix is straightforward, the PR lacks test coverage for this critical path. Recommended tests:
  • Vision request with conversation history (image + context)
  • Text-only request with conversation history (baseline)
  • Mixed conversation (text → image → text sequence)
  • Edge case: Empty conversation history with image
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

Follow us: Beetle · X · LinkedIn

@beetle-ai

beetle-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

✅ You're good to merge this PR! No issues found. Great job!

Settings
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

@devhub-bot

devhub-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Note

Linting checks passed successfully 🎉

All formatting and code quality checks are clean.

You're good to merge 🚀

@beetle-ai

beetle-ai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary by Beetle

This PR refines the bot's system prompts to improve response quality and user experience. The changes focus on making tool usage more transparent, adding structured attribution information, streamlining the personality model, and fixing a tool reference inconsistency. The overall goal is to reduce unwanted meta-commentary about tool usage while maintaining the bot's casual, helpful personality.

📁 File Changes Summary (Consolidated across all commits):

File Status Changes Description
src/prompts/base.ts Modified +4/-1 Enhanced tool usage instructions to explicitly prohibit announcing tool usage or including tags like <search> or <react> in responses. Added import and integration of new INFO module for attribution handling.
src/prompts/info.ts Added +8/-0 New module defining structured attribution information including project credits (Rael v2 on GitHub), creator credits (Caleb and Aditya), tech stack (Discord.js/TypeScript), license (GPL-3.0), and bug reporting guidance. Only surfaces when explicitly asked.
src/prompts/persona.ts Modified +1/-6 Simplified personality definition by removing overly specific behavioral traits (chaotic energy, trending slang adoption, late night mode) and example interactions. Retained core MODE SWITCH logic and friend-not-customer approach for cleaner, more maintainable persona.
src/prompts/tools.ts Modified +1/-1 Fixed tool reference from reactToDiscord to react for consistency with actual tool implementation.

Total Changes: 4 files changed, +14 additions, -8 deletions

🗺️ Walkthrough:

graph TD
A["System Prompt Assembly"] --> B["Base Instructions"]
A --> C["Tool Guidelines"]
A --> D["Persona Definition"]
A --> E["Attribution Info"]
B --> B1["Concise format rules"]
B --> B2["Discord moderation policy"]
C --> C1["Silent tool usage"]
C --> C2["No meta-commentary"]
C3["Web search preferences"]
C4["Reaction tool: 'react'"]
C --> C3
C --> C4
D --> D1["MODE SWITCH logic"]
D --> D2["Casual vs Help mode"]
D1 -.->|"Help request"| D3["Full answers, normal grammar"]
D1 -.->|"Casual chat"| D4["Short, lowercase, minimal"]
E --> E1["Project credits"]
E --> E2["Creator attribution"]
E --> E3["Tech stack info"]
E --> E4["License & bug reporting"]
style C2 fill:#90EE90
style E fill:#FFD700
style D1 fill:#87CEEB
Loading

🎯 Key Changes:

  • Enhanced Tool Usage Transparency: Strengthened instructions to prevent the bot from announcing tool usage or including meta-tags like <search> or <react> in responses, creating a more natural conversational flow
  • Structured Attribution System: Introduced dedicated INFO module that provides project credits, creator attribution, tech stack details, and support channels only when explicitly requested by users
  • Streamlined Personality Model: Removed overly specific behavioral traits (chaotic energy, late night mode, trending slang) while preserving the core MODE SWITCH logic that balances casual chat with helpful explanations
  • Tool Reference Consistency: Corrected tool name from reactToDiscord to react to match actual implementation

📊 Impact Assessment:

  • Security: No security implications. Changes are limited to prompt engineering and don't affect authentication, data handling, or access control mechanisms.
  • Performance: Negligible performance impact. Slightly reduced prompt token count (~50 tokens) due to persona simplification may marginally improve response latency. The new INFO module adds minimal overhead only when explicitly invoked.
  • Maintainability: Significantly improved. The introduction of the INFO module creates better separation of concerns, making attribution details easier to update. Simplified persona definition reduces cognitive load and makes the bot's behavior more predictable. The modular structure (base.tsinfo.ts, persona.ts, tools.ts) follows clean architecture principles.
  • Testing: No test files modified. Recommended testing areas:
  • Verify tool usage no longer produces meta-commentary (e.g., "reacts with umbrella")
  • Confirm INFO responses only appear when explicitly asked about credits/source/license
  • Validate MODE SWITCH still correctly distinguishes help requests from casual chat
  • Test reaction tool invocation with corrected react reference
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

Follow us: Beetle · X · LinkedIn

@devhub-bot

devhub-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Note

Linting checks passed successfully 🎉

All formatting and code quality checks are clean.

You're good to merge 🚀

@beetle-ai

beetle-ai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ You're good to merge this PR! No issues found. Great job!

Settings
⚙️ Settings

Severity Threshold: Medium — Balanced feedback — medium and high severity issues only.Change in Settings
Custom Rules: Define your own review rules — Set Custom Rules
PR Summary: Configure PR summary — Change in Settings

📖 User Guide
  • Once repos are connected, PR analysis is automatically enabled. You can disable analysis for this repo from beetleai.dev/analysis
  • Comment @beetle on any PR to start analysis manually
  • Comment @beetle stop to stop any ongoing analysis

@calebephrem calebephrem merged commit ec46ea9 into open-devhub:main Jul 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant