mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
stop propagation in the chat panelcl
This commit is contained in:
parent
9007436ff6
commit
e47b1cb4c5
4 changed files with 34 additions and 36 deletions
|
|
@ -1,10 +1,10 @@
|
|||
"use client";
|
||||
|
||||
import { Pencil } from "lucide-react";
|
||||
import { useCallback, useContext } from "react";
|
||||
import { useCallback, useContext, useState } from "react";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { chatInterfaceContext } from "../ChatInterface";
|
||||
import type { GeneratePodcastRequest } from "./actions";
|
||||
import type { GeneratePodcastRequest } from "./ChatPanelContainer";
|
||||
|
||||
interface ConfigModalProps {
|
||||
generatePodcast: (request: GeneratePodcastRequest) => Promise<void>;
|
||||
|
|
@ -19,25 +19,25 @@ export function ConfigModal(props: ConfigModalProps) {
|
|||
const { chatDetails } = context;
|
||||
const { generatePodcast } = props;
|
||||
|
||||
const [podcastTitle, setPodcastTitle] = useState(chatDetails?.title);
|
||||
|
||||
const handleGeneratePost = useCallback(async () => {
|
||||
if (!chatDetails) return;
|
||||
await generatePodcast({
|
||||
type: "CHAT",
|
||||
ids: [chatDetails.id],
|
||||
search_space_id: chatDetails.search_space_id,
|
||||
podcast_title: chatDetails.title,
|
||||
podcast_title: podcastTitle,
|
||||
});
|
||||
}, [chatDetails]);
|
||||
}, [chatDetails, podcastTitle]);
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger>
|
||||
<button
|
||||
type="button"
|
||||
title="Edit the prompt"
|
||||
className="rounded-full p-2 bg-slate-400/30 hover:bg-slate-400/40"
|
||||
>
|
||||
<Pencil strokeWidth={1} className="h-4 w-4" />
|
||||
</button>
|
||||
<PopoverTrigger
|
||||
title="Edit the prompt"
|
||||
className="rounded-full p-2 bg-slate-400/30 hover:bg-slate-400/40"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Pencil strokeWidth={1} className="h-4 w-4" />
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="end" className="bg-sidebar w-96 ">
|
||||
<form className="flex flex-col gap-3 w-full">
|
||||
|
|
@ -48,8 +48,9 @@ export function ConfigModal(props: ConfigModalProps) {
|
|||
<textarea
|
||||
name="prompt"
|
||||
id="prompt"
|
||||
defaultValue={chatDetails?.title}
|
||||
defaultValue={podcastTitle}
|
||||
className="w-full rounded-md border border-slate-400/40 p-2"
|
||||
onChange={(e) => setPodcastTitle(e.target.value)}
|
||||
></textarea>
|
||||
|
||||
<button
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue