Start chat with public and protected agents when shared via link

This commit is contained in:
Debanjum Singh Solanky
2024-10-08 22:07:23 -07:00
parent 80212c50fd
commit dd770cf1b9
2 changed files with 5 additions and 3 deletions

View File

@@ -137,7 +137,9 @@ async function openChat(slug: string, userData: UserProfile | null) {
return;
}
const response = await fetch(`/api/chat/sessions?agent_slug=${slug}`, { method: "POST" });
const response = await fetch(`/api/chat/sessions?agent_slug=${encodeURIComponent(slug)}`, {
method: "POST",
});
const data = await response.json();
if (response.status == 200) {
window.location.href = `/chat?conversationId=${data.conversation_id}`;