discourse/plugins/discourse-ai/evals/lib/boot.rb
Natalie Tay 4adc725d9b
DEV: Switch AI debug messages to off by default (#35320)
We do have a lot of messages like the following in dev logs turned on by
default.

```
DiscourseAi::Completions::Endpoints::AwsBedrock: request_tokens 22 response_tokens 13
DiscourseAi::Completions::Endpoints::AwsBedrock: request_tokens 51 response_tokens 57
DiscourseAi::Completions::Endpoints::AwsBedrock: request_tokens 22 response_tokens 13
DiscourseAi::Completions::Endpoints::Gemini: request_tokens 42 response_tokens 9
```

So switching it around to off by default. `DISCOURSE_AI_NO_DEBUG` ->
`DISCOURSE_AI_DEBUG`.

t/159704/34
2025-10-10 21:47:36 +08:00

35 lines
1 KiB
Ruby

# frozen_string_literal: true
# got to ensure evals are here
# rubocop:disable Discourse/Plugins/NamespaceConstants
EVAL_PATH = File.join(__dir__, "../cases")
# rubocop:enable Discourse/Plugins/NamespaceConstants
#
if !Dir.exist?(EVAL_PATH)
puts "Evals are missing, cloning from discourse/discourse-ai-evals"
success =
system("git clone git@github.com:discourse/discourse-ai-evals.git '#{EVAL_PATH}' 2>/dev/null")
# Fall back to HTTPS if SSH fails
if !success
puts "SSH clone failed, falling back to HTTPS..."
success = system("git clone https://github.com/discourse/discourse-ai-evals.git '#{EVAL_PATH}'")
end
if success
puts "Successfully cloned evals repository"
else
abort "Failed to clone evals repository"
end
end
discourse_path = ENV["DISCOURSE_PATH"] || File.expand_path(File.join(__dir__, "../../../.."))
# rubocop:disable Discourse/NoChdir
Dir.chdir(discourse_path)
# rubocop:enable Discourse/NoChdir
require "#{discourse_path}/config/environment"
module DiscourseAi::Evals
end