2023-06-21 03:10:30 -04:00
|
|
|
#frozen_string_literal: true
|
|
|
|
|
2024-01-04 08:44:07 -05:00
|
|
|
RSpec.describe DiscourseAi::AiBot::Tools::Time do
|
2024-07-30 12:44:57 -04:00
|
|
|
fab!(:llm_model)
|
|
|
|
let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }
|
|
|
|
let(:llm) { DiscourseAi::Completions::Llm.proxy("custom:#{llm_model.id}") }
|
2024-01-04 08:44:07 -05:00
|
|
|
|
|
|
|
before { SiteSetting.ai_bot_enabled = true }
|
|
|
|
|
2023-06-21 03:10:30 -04:00
|
|
|
describe "#process" do
|
|
|
|
it "can generate correct info" do
|
|
|
|
freeze_time
|
|
|
|
|
2023-08-03 19:37:58 -04:00
|
|
|
args = { timezone: "America/Los_Angeles" }
|
2024-05-07 07:55:46 -04:00
|
|
|
info = described_class.new(args, bot_user: bot_user, llm: llm).invoke
|
2023-06-21 03:10:30 -04:00
|
|
|
|
|
|
|
expect(info).to eq({ args: args, time: Time.now.in_time_zone("America/Los_Angeles").to_s })
|
|
|
|
expect(info.to_s).not_to include("not_here")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|