mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
fix key down events
This commit is contained in:
parent
2902fd6d28
commit
87c5d24f29
4 changed files with 9 additions and 9 deletions
|
|
@ -13,6 +13,7 @@ export interface GeneratePodcastRequest {
|
|||
ids: number[];
|
||||
search_space_id: number;
|
||||
podcast_title?: string;
|
||||
user_prompt?: string;
|
||||
}
|
||||
|
||||
export function ChatPanelContainer() {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export function ChatPanelView(props: ChatPanelViewProps) {
|
|||
tabIndex={0}
|
||||
onClick={handleGeneratePost}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
handleGeneratePost();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function ConfigModal(props: ConfigModalProps) {
|
|||
|
||||
const { generatePodcast } = props;
|
||||
|
||||
const [podcastTitle, setPodcastTitle] = useState(podcast?.title || chatDetails?.title);
|
||||
const [userPromt, setUserPrompt] = useState("");
|
||||
|
||||
const handleGeneratePost = useCallback(async () => {
|
||||
if (!chatDetails) return;
|
||||
|
|
@ -27,9 +27,10 @@ export function ConfigModal(props: ConfigModalProps) {
|
|||
type: "CHAT",
|
||||
ids: [chatDetails.id],
|
||||
search_space_id: chatDetails.search_space_id,
|
||||
podcast_title: podcastTitle || podcast?.title || chatDetails.title,
|
||||
podcast_title: podcast?.title || chatDetails.title,
|
||||
user_prompt: userPromt,
|
||||
});
|
||||
}, [chatDetails, podcastTitle]);
|
||||
}, [chatDetails, userPromt]);
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
|
|
@ -49,11 +50,11 @@ export function ConfigModal(props: ConfigModalProps) {
|
|||
<textarea
|
||||
name="prompt"
|
||||
id="prompt"
|
||||
defaultValue={podcastTitle}
|
||||
defaultValue={userPromt}
|
||||
className="w-full rounded-md border border-slate-400/40 p-2"
|
||||
onChange={(e) => {
|
||||
e.stopPropagation();
|
||||
setPodcastTitle(e.target.value);
|
||||
setUserPrompt(e.target.value);
|
||||
}}
|
||||
></textarea>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ export const getPodcastByChatId = async (chatId: string, authToken: string) => {
|
|||
|
||||
export const generatePodcast = async (request: GeneratePodcastRequest, authToken: string) => {
|
||||
try {
|
||||
const { podcast_title = "SurfSense Podcast" } = request;
|
||||
|
||||
const response = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/podcasts/generate/`,
|
||||
{
|
||||
|
|
@ -38,7 +36,7 @@ export const generatePodcast = async (request: GeneratePodcastRequest, authToken
|
|||
Authorization: `Bearer ${authToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ ...request, podcast_title }),
|
||||
body: JSON.stringify(request),
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue