LibreMedia Assistant is a Ruby on Rails microservice that connects the main LibreMedia backend with AI models. It provides REST endpoints for editorial translations, transcript-to-article drafts, comment moderation, and future AI tasks.
- Translates post fields from one source language into the remaining supported blog locales.
- Turns vlog transcripts or subtitles into coherent article drafts.
- Classifies comments as approved, pending, spam, or deleted.
- Exposes generated OpenAPI documentation through Swagger UI.
| Tool | Version |
|---|---|
| Ruby | 3.4.x |
| Rails | 8.0.x |
| API Token | Required |
git clone git@github.com:WebgateSystems/LM-assistant.git
cd LM-support-assistantbundle installchat_gpt_api_key: 'you gpt api key'The assistant uses Bearer tokens stored in access_tokens. Tokens belong to a local assistant User.
Create or reuse a service user and print a token:
bin/rails runner 'user = User.find_or_create_by!(email: "libremedia@app.local") { |u| u.name = "LibreMedia"; u.password = SecureRandom.hex(24); u.password_confirmation = u.password }; token = user.access_tokens.where(active: true).first || user.access_tokens.create!; puts token.token'You can also create a session and receive the same active token:
curl -X POST http://127.0.0.1:3000/api/v1/session \
-H "Content-Type: application/json" \
-d '{
"user": {
"email": "libremedia@app.local",
"password": "the-password-you-created"
}
}'Use the printed token as Authorization: Bearer <token> in calls from LibreMedia.
In the main LibreMedia application, configure the assistant as an external service:
# config/settings.yml or config/settings/<environment>.yml
services:
assistant:
endpoint: http://127.0.0.1:3000
token: your_api_token_hereProduction should provide these values through environment variables:
LM_ASSISTANT_ENDPOINT=https://assistant.libremedia.org
LM_ASSISTANT_TOKEN=your_api_token_hererails serverAfter generating Swagger from request specs, documentation is served at:
https://assistant.libremedia.org/api-docs/Generate or refresh OpenAPI locally:
bundle exec rake rswag:specs:swaggerizeContent-Type: application/json
Authorization: Bearer your_api_token_herePOST /api/v1/assistant/translationsExample request:
curl -X POST http://127.0.0.1:3000/api/v1/assistant/translations \
-H "Authorization: Bearer your_api_token_here" \
-H "Content-Type: application/json" \
-d '{
"translation": {
"source_locale": "pl",
"target_locales": ["uk", "ru", "en"],
"content_format": "markdown",
"content": {
"title": "Polski tytuł",
"subtitle": "Krótki podtytuł",
"lead": "Lead artykułu",
"content_source": "Treść wpisu",
"keywords": "media, wolność słowa",
"meta_description": "Opis SEO"
},
"metadata": {
"post_id": "optional-post-id"
}
}
}'Example response:
{
"data": {
"translations": {
"en": {
"title": "English title",
"content_source": "Translated article body"
}
},
"confidence": 0.94,
"warnings": []
},
"meta": {
"model": "gpt-5-mini"
}
}