viswanatha
(P Viswanatha Reddy)
Agosto 21, 2025, 6:32am
1
Tenho um fórum Discourse auto-hospedado e estou encontrando um Erro Interno do Servidor ao configurar o Discourse AI e os LLMs Manuais. Como posso resolver esse problema? Você poderia compartilhar algum guia útil para me ajudar ainda mais?
Capturas de tela do erro
Falha ao carregar recurso: o servidor respondeu com um status de 500 ()
Capturas de tela Passos realizados:
Roman
(Roman Rizzi)
Agosto 21, 2025, 1:27pm
2
Verifique sua rota /logs e veja se há mais informações sobre o erro lá. Se bem me lembro, Ollama precisa de algo no campo da chave da API, mesmo que não seja usado.
viswanatha
(P Viswanatha Reddy)
Agosto 25, 2025, 5:11am
3
@Roman
Abaixo estão os logs
info Message
NoMethodError (método não definido `-' para nil)
app/controllers/application_controller.rb:428:in `block in with_resolved_locale'
app/controllers/application_controller.rb:428:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:35:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:415:in `call'
lib/middleware/csp_script_nonce_injector.rb:12:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
lib/middleware/default_headers.rb:13:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/processing_request.rb:12:in `call'
lib/middleware/request_tracker.rb:410:in `call'
Backtrace
plugins/discourse-ai/lib/completions/dialects/chat_gpt.rb:47:in `max_prompt_tokens'
plugins/discourse-ai/lib/completions/dialects/dialect.rb:134:in `trim_messages'
plugins/discourse-ai/lib/completions/dialects/dialect.rb:83:in `translate'
plugins/discourse-ai/lib/completions/endpoints/base.rb:123:in `perform_completion!'
plugins/discourse-ai/lib/completions/endpoints/open_ai.rb:53:in `perform_completion!'
plugins/discourse-ai/lib/completions/llm.rb:415:in `generate'
plugins/discourse-ai/lib/configuration/llm_validator.rb:36:in `run_test'
plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rb:143:in `test'
actionpack (8.0.2.1) lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action'
actionpack (8.0.2.1) lib/abstract_controller/base.rb:226:in `process_action'
actionpack (8.0.2.1) lib/action_controller/metal/rendering.rb:193:in `process_action'
actionpack (8.0.2.1) lib/abstract_controller/callbacks.rb:261:in `block in process_action'
activesupport (8.0.2.1) lib/active_support/callbacks.rb:120:in `block in run_callbacks'
app/controllers/application_controller.rb:428:in `block in with_resolved_locale'
i18n (1.14.7) lib/i18n.rb:353:in `with_locale'
app/controllers/application_controller.rb:428:in `with_resolved_locale'
activesupport (8.0.2.1) lib/active_support/callbacks.rb:129:in `block in run_callbacks'
activesupport (8.0.2.1) lib/active_support/callbacks.rb:140:in `run_callbacks'
actionpack (8.0.2.1) lib/abstract_controller/callbacks.rb:260:in `process_action'
actionpack (8.0.2.1) lib/action_controller/metal/rescue.rb:27:in `process_action'
actionpack (8.0.2.1) lib/action_controller/metal/instrumentation.rb:76:in `block in process_action'
activesupport (8.0.2.1) lib/active_support/notifications.rb:210:in `block in instrument'
activesupport (8.0.2.1) lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activesupport (8.0.2.1) lib/active_support/notifications.rb:210:in `instrument'
actionpack (8.0.2.1) lib/action_controller/metal/instrumentation.rb:75:in `process_action'
actionpack (8.0.2.1) lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord (8.0.2.1) lib/active_record/railties/controller_runtime.rb:39:in `process_action'
actionpack (8.0.2.1) lib/abstract_controller/base.rb:163:in `process'
actionview (8.0.2.1) lib/action_view/rendering.rb:40:in `process'
rack-mini-profiler (4.0.1) lib/mini_profiler/profiling_methods.rb:116:in `block in profile_method'
actionpack (8.0.2.1) lib/action_controller/metal.rb:252:in `dispatch'
actionpack (8.0.2.1) lib/action_controller/metal.rb:335:in `dispatch'
actionpack (8.0.2.1) lib/action_dispatch/routing/route_set.rb:67:in `dispatch'
actionpack (8.0.2.1) lib/action_dispatch/routing/route_set.rb:50:in `serve'
actionpack (8.0.2.1) lib/action_dispatch/routing/mapper.rb:32:in `block in <class:Constraints>'
actionpack (8.0.2.1) lib/action_dispatch/routing/mapper.rb:62:in `serve'
actionpack (8.0.2.1) lib/action_dispatch/journey/router.rb:53:in `block in serve'
actionpack (8.0.2.1) lib/action_dispatch/journey/router.rb:133:in `block in find_routes'
actionpack (8.0.2.1) lib/action_dispatch/journey/router.rb:126:in `each'
actionpack (8.0.2.1) lib/action_dispatch/journey/router.rb:126:in `find_routes'
actionpack (8.0.2.1) lib/action_dispatch/journey/router.rb:34:in `serve'
actionpack (8.0.2.1) lib/action_dispatch/routing/route_set.rb:908:in `call'
lib/middleware/omniauth_bypass_middleware.rb:35:in `call'
rack (2.2.17) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.17) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.17) lib/rack/head.rb:12:in `call'
actionpack (8.0.2.1) lib/action_dispatch/http/permissions_policy.rb:38:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:415:in `call'
lib/middleware/csp_script_nonce_injector.rb:12:in `call'
config/initializers/008-rack-cors.rb:14:in `call'
rack (2.2.17) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.17) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/cookies.rb:706:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/callbacks.rb:31:in `block in call'
activesupport (8.0.2.1) lib/active_support/callbacks.rb:100:in `run_callbacks'
actionpack (8.0.2.1) lib/action_dispatch/middleware/callbacks.rb:30:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:31:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/show_exceptions.rb:32:in `call'
logster (2.20.1) lib/logster/middleware/reporter.rb:40:in `call'
lib/middleware/default_headers.rb:13:in `call'
railties (8.0.2.1) lib/rails/rack/logger.rb:41:in `call_app'
railties (8.0.2.1) lib/rails/rack/logger.rb:29:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/request_id.rb:34:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
rack (2.2.17) lib/rack/method_override.rb:24:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/executor.rb:16:in `call'
rack (2.2.17) lib/rack/sendfile.rb:110:in `call'
rack-mini-profiler (4.0.1) lib/mini_profiler.rb:334:in `call'
lib/middleware/processing_request.rb:12:in `call'
message_bus (4.4.1) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:410:in `call'
actionpack (8.0.2.1) lib/action_dispatch/middleware/remote_ip.rb:96:in `call'
railties (8.0.2.1) lib/rails/engine.rb:535:in `call'
railties (8.0.2.1) lib/rails/railtie.rb:226:in `public_send'
railties (8.0.2.1) lib/rails/railtie.rb:226:in `method_missing'
rack (2.2.17) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.17) lib/rack/urlmap.rb:58:in `each'
rack (2.2.17) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `<main>'
Roman
(Roman Rizzi)
Agosto 28, 2025, 2:02pm
4
Você precisa preencher todos os campos obrigatórios para executar o teste. O erro que você compartilhou acontece porque você não especificou uma janela de contexto para o modelo.
viswanatha
(P Viswanatha Reddy)
Setembro 2, 2025, 9:31am
5
Mensagem de erro:
Tentando contatar o modelo retornou este erro: {"error":{"message":"[] é muito curto - 'messages'","type":"invalid_request_error","param":null,"code":null}}
Logs
Mensagem (2 cópias relatadas)
DiscourseAi::Completions::Endpoints::OpenAi: status: 400 - body: {"error":{"message":"[] é muito curto - 'messages'","type":"invalid_request_error","param":null,"code":null}}
Backtrace
activesupport-8.0.2.1/lib/active_support/broadcast_logger.rb:134:in `block in error'
activesupport-8.0.2.1/lib/active_support/broadcast_logger.rb:231:in `block in dispatch'
activesupport-8.0.2.1/lib/active_support/broadcast_logger.rb:231:in `each'
activesupport-8.0.2.1/lib/active_support/broadcast_logger.rb:231:in `dispatch'
activesupport-8.0.2.1/lib/active_support/broadcast_logger.rb:134:in `error'
/var/www/discourse/plugins/discourse-ai/lib/completions/endpoints/base.rb:170:in `block (2 levels) in perform_completion!'
net-http-0.6.0/lib/net/http.rb:2433:in `block in transport_request'
net-http-0.6.0/lib/net/http/response.rb:320:in `reading_body'
net-http-0.6.0/lib/net/http.rb:2430:in `transport_request'
net-http-0.6.0/lib/net/http.rb:2384:in `request'
rack-mini-profiler-4.0.1/lib/patches/net_patches.rb:19:in `block in request_with_mini_profiler'
rack-mini-profiler-4.0.1/lib/mini_profiler/profiling_methods.rb:45:in `step'
rack-mini-profiler-4.0.1/lib/patches/net_patches.rb:18:in `request_with_mini_profiler'
/var/www/discourse/plugins/discourse-ai/lib/completions/endpoints/base.rb:168:in `block in perform_completion!'
net-http-0.6.0/lib/net/http.rb:1632:in `start'
net-http-0.6.0/lib/net/http.rb:1070:in `start'
/var/www/discourse/plugins/discourse-ai/lib/completions/endpoints/base.rb:139:in `perform_completion!'
/var/www/discourse/plugins/discourse-ai/lib/completions/endpoints/open_ai.rb:53:in `perform_completion!'
/var/www/discourse/plugins/discourse-ai/lib/completions/llm.rb:415:in `generate'
/var/www/discourse/plugins/discourse-ai/lib/configuration/llm_validator.rb:36:in `run_test'
/var/www/discourse/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rb:143:in `test'
actionpack-8.0.2.1/lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action'
actionpack-8.0.2.1/lib/abstract_controller/base.rb:226:in `process_action'
actionpack-8.0.2.1/lib/action_controller/metal/rendering.rb:193:in `process_action'
actionpack-8.0.2.1/lib/abstract_controller/callbacks.rb:261:in `block in process_action'
activesupport-8.0.2.1/lib/active_support/callbacks.rb:120:in `block in run_callbacks'
/var/www/discourse/app/controllers/application_controller.rb:428:in `block in with_resolved_locale'
i18n-1.14.7/lib/i18n.rb:353:in `with_locale'
/var/www/discourse/app/controllers/application_controller.rb:428:in `with_resolved_locale'
activesupport-8.0.2.1/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
activesupport-8.0.2.1/lib/active_support/callbacks.rb:140:in `run_callbacks'
actionpack-8.0.2.1/lib/abstract_controller/callbacks.rb:260:in `process_action'
actionpack-8.0.2.1/lib/action_controller/metal/rescue.rb:27:in `process_action'
actionpack-8.0.2.1/lib/action_controller/metal/instrumentation.rb:76:in `block in process_action'
activesupport-8.0.2.1/lib/active_support/notifications.rb:210:in `block in instrument'
activesupport-8.0.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activesupport-8.0.2.1/lib/active_support/notifications.rb:210:in `instrument'
actionpack-8.0.2.1/lib/action_controller/metal/instrumentation.rb:75:in `process_action'
actionpack-8.0.2.1/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
activerecord-8.0.2.1/lib/active_record/railties/controller_runtime.rb:39:in `process_action'
actionpack-8.0.2.1/lib/abstract_controller/base.rb:163:in `process'
actionview-8.0.2.1/lib/action_view/rendering.rb:40:in `process'
rack-mini-profiler-4.0.1/lib/mini_profiler/profiling_methods.rb:116:in `block in profile_method'
actionpack-8.0.2.1/lib/action_controller/metal.rb:252:in `dispatch'
actionpack-8.0.2.1/lib/action_controller/metal.rb:335:in `dispatch'
actionpack-8.0.2.1/lib/action_dispatch/routing/route_set.rb:67:in `dispatch'
actionpack-8.0.2.1/lib/action_dispatch/routing/route_set.rb:50:in `serve'
actionpack-8.0.2.1/lib/action_dispatch/routing/mapper.rb:32:in `block in <class:Constraints>'
actionpack-8.0.2.1/lib/action_dispatch/routing/mapper.rb:62:in `serve'
actionpack-8.0.2.1/lib/action_dispatch/journey/router.rb:53:in `block in serve'
actionpack-8.0.2.1/lib/action_dispatch/journey/router.rb:133:in `block in find_routes'
actionpack-8.0.2.1/lib/action_dispatch/journey/router.rb:126:in `each'
actionpack-8.0.2.1/lib/action_dispatch/journey/router.rb:126:in `find_routes'
actionpack-8.0.2.1/lib/action_dispatch/journey/router.rb:34:in `serve'
actionpack-8.0.2.1/lib/action_dispatch/routing/route_set.rb:908:in `call'
/var/www/discourse/lib/middleware/omniauth_bypass_middleware.rb:35:in `call'
rack-2.2.17/lib/rack/tempfile_reaper.rb:15:in `call'
rack-2.2.17/lib/rack/conditional_get.rb:27:in `call'
rack-2.2.17/lib/rack/head.rb:12:in `call'
actionpack-8.0.2.1/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
/var/www/discourse/lib/content_security_policy/middleware.rb:12:in `call'
/var/www/discourse/lib/middleware/anonymous_cache.rb:415:in `call'
/var/www/discourse/lib/middleware/csp_script_nonce_injector.rb:12:in `call'
/var/www/discourse/config/initializers/008-rack-cors.rb:14:in `call'
rack-2.2.17/lib/rack/session/abstract/id.rb:266:in `context'
rack-2.2.17/lib/rack/session/abstract/id.rb:260:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/cookies.rb:706:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/callbacks.rb:31:in `block in call'
activesupport-8.0.2.1/lib/active_support/callbacks.rb:100:in `run_callbacks'
actionpack-8.0.2.1/lib/action_dispatch/middleware/callbacks.rb:30:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:31:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/show_exceptions.rb:32:in `call'
logster-2.20.1/lib/logster/middleware/reporter.rb:40:in `call'
/var/www/discourse/lib/middleware/default_headers.rb:13:in `call'
railties-8.0.2.1/lib/rails/rack/logger.rb:41:in `call_app'
railties-8.0.2.1/lib/rails/rack/logger.rb:29:in `call'
/var/www/discourse/config/initializers/100-quiet_logger.rb:20:in `call'
/var/www/discourse/config/initializers/100-silence_logger.rb:29:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/request_id.rb:34:in `call'
/var/www/discourse/lib/middleware/enforce_hostname.rb:23:in `call'
rack-2.2.17/lib/rack/method_override.rb:24:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/executor.rb:16:in `call'
rack-2.2.17/lib/rack/sendfile.rb:110:in `call'
rack-mini-profiler-4.0.1/lib/mini_profiler.rb:334:in `call'
/var/www/discourse/lib/middleware/processing_request.rb:12:in `call'
message_bus-4.4.1/lib/message_bus/rack/middleware.rb:60:in `call'
/var/www/discourse/lib/middleware/request_tracker.rb:410:in `call'
actionpack-8.0.2.1/lib/action_dispatch/middleware/remote_ip.rb:96:in `call'
railties-8.0.2.1/lib/rails/engine.rb:535:in `call'
railties-8.0.2.1/lib/rails/railtie.rb:226:in `public_send'
railties-8.0.2.1/lib/rails/railtie.rb:226:in `method_missing'
rack-2.2.17/lib/rack/urlmap.rb:74:in `block in call'
rack-2.2.17/lib/rack/urlmap.rb:58:in `each'
rack-2.2.17/lib/rack/urlmap.rb:58:in `call'
unicorn-6.1.0/lib/unicorn/http_server.rb:634:in `process_client'
unicorn-6.1.0/lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn-6.1.0/lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn-6.1.0/lib/unicorn/http_server.rb:143:in `start'
unicorn-6.1.0/bin/unicorn:128:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/bin/unicorn:25:in `<main>'
viswanatha
(P Viswanatha Reddy)
Setembro 4, 2025, 12:16pm
6
Olá @Roman
Estou enfrentando um novo problema.
Por favor, encontre os logs nos comentários de rastreamento acima e sugira as alterações necessárias, se houver, ou qual pode ser o motivo do problema.
viswanatha
(P Viswanatha Reddy)
Setembro 5, 2025, 11:10am
7
Quando desmarquei a opção Habilitar API de resposta (requer em certos modelos OpenAI) , o teste foi bem-sucedido
1 curtida
viswanatha
(P Viswanatha Reddy)
Setembro 5, 2025, 1:46pm
8
Esta é a resposta cURL que recebemos ao tentarmos a ação, independentemente do Discourse.
curl -X POST http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "deepseek-coder-v2:latest",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the latest version of Conan as per 2025"
}
],
"temperature": 0.7,
"max_tokens": 200
}'
{"id":"chatcmpl-940","object":"chat.completion","created":1757057197,"model":"deepseek-coder-v2:latest","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":" Até minha última atualização no início de 2023, não há informações específicas sobre \"Conan\" após 2025, pois não tenho capacidades de previsão futura ou dados em tempo real. No entanto, posso fornecer alguns conselhos gerais sobre como encontrar a versão mais recente do Conan, que é um gerenciador de pacotes para gerenciamento de dependências C/C++:\n\n1. **Visite o Site Oficial:** A maneira mais confiável de obter informações sobre a versão mais recente do Conan é visitar o site oficial em https://conan.io/. Lá, você geralmente pode encontrar as notas de lançamento mais recentes e a documentação relacionada à versão mais recente.\n\n2. **Verifique o Repositório do GitHub:** O código-fonte do Conan está hospedado no GitHub, portanto, você também pode verificar o repositório (https://github.com/conan-io/conan) em busca de lançamentos ou tags que correspondam a diferentes versões. O repositório geralmente inclui notas de lançamento na forma de commits e pull requests.\n\n3"},"finish_reason":"length"}],"usage":{"prompt_tokens":30,"completion_tokens":200,"total_tokens":230}}
system
(system)
Fechado
Outubro 5, 2025, 1:47pm
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.