Merged
Conversation
Pull Request Test Coverage Report for Build 19448429339Details
💛 - Coveralls |
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.
Tool Description
This PR integrates automatic LLM-based translation into NodeBB.
When a user posts a message in a non-English language, NodeBB detects this and sends the content to a remote translation service running on a GPU VM. The service uses a Flask-based API backed by an Ollama LLM to produce a high-quality English translation. The final UI displays the translated message directly underneath the original post in a clear, styled info panel.
This feature improves accessibility, cross-language communication, and supports mixed-language communities without modifying the core posting flow.
How it works:
NodeBB → GPU VM:
NodeBB sends
POST /translatewith the post content.GPU VM responds with:
{ "is_english": false, "translated_content": "…" }Non-English posts are annotated with the translation and rendered in the UI.
Changes Made
Backend Integration (UI VM – NodeBB)
Implemented remote translation pipeline in
src/translate/index.js.Calls GPU VM endpoint:
http://crs-17313-nodegpt-gpu.qatar.cmu.edu/translate.Added
try/catchto prevent “fetch failed” from crashing the site.Ensures the output matches NodeBB’s expected data structure:
Attached translation fields to post data:
posts.isEnglishposts.translatedContentUpdated post creation logic to correctly store translated content in post metadata.
UI Rendering (Frontend)
Modified
public/templates/partials/topic/post.tplto show translations directly for non-English posts.Final UI (no toggle/button):
“Translated message: ”
Ensures visibility only when
posts.isEnglish === false.GPU VM Translation Service (Remote)
(Not part of this repository but required for full functionality)
/translate) configured for external access.Evidence of Successful Integration
Backend Logs (UI VM)
NodeBB logs confirm successful translation and data flow:
UI Output
For a German post:
End-to-End Verification
Files Modified
src/translate/index.jspublic/templates/partials/topic/post.tplpublic/src/client/topic.js(light cleanup to remove unused button logic)Summary
This PR delivers full multilingual support by integrating NodeBB with a GPU-accelerated LLM translation service. The solution is resilient, production-safe, and improves user experience by showing translations directly in the UI without additional interaction.