mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 14:38:37 +00:00 
			
		
		
		
	previously you would have to wait quite a while to see the prompt this implements a very basic implementation of progress so you can see the API is working. Also: - Fix google progress. - Handle the incredibly rare, zero results from google. - Simplify command so it is less error prone - replace invoke and attache results with a invoke - ensure invoke can only ever be run once - pass in all the information a command needs in constructor - use new pattern throughout - test invocation in isolation
		
			
				
	
	
		
			18 lines
		
	
	
		
			565 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			565 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(bot_user: nil, args: 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
 |