discourse-ai/spec/system/ai_bot/ai_share_conversation_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

32 lines
973 B
Ruby

# frozen_string_literal: true
RSpec.describe "Share conversation via link", type: :system do
fab!(:admin) { Fabricate(:admin, username: "ai_sharer") }
fab!(:gpt_4) { Fabricate(:llm_model, name: "gpt-4") }
before do
SiteSetting.ai_bot_enabled = true
toggle_enabled_bots(bots: [gpt_4])
SiteSetting.ai_bot_public_sharing_allowed_groups = "1" # admin
Group.refresh_automatic_groups!
sign_in(admin)
end
let(:pm) do
Fabricate(
:private_message_topic,
title: "This is my special PM",
user: admin,
topic_allowed_users: [Fabricate.build(:topic_allowed_user, user: admin)],
)
end
let!(:op) { Fabricate(:post, topic: pm, user: admin, raw: "test test test user reply") }
it "does not show share button for my own PMs without bot" do
visit(pm.url)
expect(Guardian.new(admin).can_share_ai_bot_conversation?(pm)).to eq(false)
expect(page).not_to have_selector(".share-ai-conversation-button")
end
end