mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-20 13:03:29 +00:00
The command framework had some confusing dispatching where it would dispatch JSON blobs, this meant there was lots of parsing required in every command The refactor handles transforming the args prior to dispatch which makes consuming far simpler This is also general prep to supporting some basic command framework in other llms.
18 lines
549 B
Ruby
18 lines
549 B
Ruby
#frozen_string_literal: true
|
|
|
|
require_relative "../../../../support/openai_completions_inference_stubs"
|
|
|
|
RSpec.describe DiscourseAi::AiBot::Commands::TimeCommand do
|
|
describe "#process" do
|
|
it "can generate correct info" do
|
|
freeze_time
|
|
|
|
args = { timezone: "America/Los_Angeles" }
|
|
info = DiscourseAi::AiBot::Commands::TimeCommand.new(nil, nil).process(**args)
|
|
|
|
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
|