mirror of
				https://github.com/discourse/discourse-ai.git
				synced 2025-10-31 22:48:37 +00:00 
			
		
		
		
	We'll create one bot user for each available model. When listed in the `ai_bot_enabled_chat_bots` setting, they will reply. This PR lets us use Claude-v1 in stream mode.
		
			
				
	
	
		
			22 lines
		
	
	
		
			648 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			648 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| RSpec.describe CompletionPrompt do
 | |
|   describe "validations" do
 | |
|     context "when there are too many messages" do
 | |
|       it "doesn't accept more than 20 messages" do
 | |
|         prompt = described_class.new(messages: [{ role: "system", content: "a" }] * 21)
 | |
| 
 | |
|         expect(prompt.valid?).to eq(false)
 | |
|       end
 | |
|     end
 | |
| 
 | |
|     context "when the message is over the max length" do
 | |
|       it "doesn't accept messages when the length is more than 1000 characters" do
 | |
|         prompt = described_class.new(messages: [{ role: "system", content: "a" * 1001 }])
 | |
| 
 | |
|         expect(prompt.valid?).to eq(false)
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |