discourse-ai/spec/system/ai_bot/ai_bot_helper_spec.rb
Roman Rizzi 8d5f901a67
DEV: Rewire AI bot internals to use LlmModel (#638)
* DRAFT: Create AI Bot users dynamically and support custom LlmModels

* Get user associated to llm_model

* Track enabled bots with attribute

* Don't store bot username. Minor touches to migrate default values in settings

* Handle scenario where vLLM uses a SRV record

* Made 3.5-turbo-16k the default version so we can remove hack
2024-06-18 14:32:14 -03:00

37 lines
1.1 KiB
Ruby

# frozen_string_literal: true
RSpec.describe "AI chat channel summarization", type: :system, js: true do
fab!(:user)
fab!(:group) { Fabricate(:group, visibility_level: Group.visibility_levels[:staff]) }
fab!(:gpt_4) { Fabricate(:llm_model, name: "gpt-4") }
fab!(:gpt_3_5_turbo) { Fabricate(:llm_model, name: "gpt-3.5-turbo") }
before do
SiteSetting.ai_bot_enabled = true
toggle_enabled_bots(bots: [gpt_4, gpt_3_5_turbo])
SiteSetting.ai_bot_allowed_groups = group.id.to_s
sign_in(user)
end
it "does not show AI button to users not in group" do
visit "/latest"
expect(page).not_to have_selector(".ai-bot-button")
end
it "shows the AI bot button, which is clickable (even if group is hidden)" do
group.add(user)
group.save
visit "/latest"
expect(page).to have_selector(".ai-bot-button")
find(".ai-bot-button").click
# composer is open
expect(page).to have_selector(".d-editor-container")
SiteSetting.ai_bot_add_to_header = false
visit "/latest"
expect(page).not_to have_selector(".ai-bot-button")
end
end