mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +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[];
|
ids: number[];
|
||||||
search_space_id: number;
|
search_space_id: number;
|
||||||
podcast_title?: string;
|
podcast_title?: string;
|
||||||
|
user_prompt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ChatPanelContainer() {
|
export function ChatPanelContainer() {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ export function ChatPanelView(props: ChatPanelViewProps) {
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={handleGeneratePost}
|
onClick={handleGeneratePost}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Enter" || e.key === " ") {
|
if (e.key === "Enter") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
handleGeneratePost();
|
handleGeneratePost();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export function ConfigModal(props: ConfigModalProps) {
|
||||||
|
|
||||||
const { generatePodcast } = props;
|
const { generatePodcast } = props;
|
||||||
|
|
||||||
const [podcastTitle, setPodcastTitle] = useState(podcast?.title || chatDetails?.title);
|
const [userPromt, setUserPrompt] = useState("");
|
||||||
|
|
||||||
const handleGeneratePost = useCallback(async () => {
|
const handleGeneratePost = useCallback(async () => {
|
||||||
if (!chatDetails) return;
|
if (!chatDetails) return;
|
||||||
|
|
@ -27,9 +27,10 @@ export function ConfigModal(props: ConfigModalProps) {
|
||||||
type: "CHAT",
|
type: "CHAT",
|
||||||
ids: [chatDetails.id],
|
ids: [chatDetails.id],
|
||||||
search_space_id: chatDetails.search_space_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 (
|
return (
|
||||||
<Popover>
|
<Popover>
|
||||||
|
|
@ -49,11 +50,11 @@ export function ConfigModal(props: ConfigModalProps) {
|
||||||
<textarea
|
<textarea
|
||||||
name="prompt"
|
name="prompt"
|
||||||
id="prompt"
|
id="prompt"
|
||||||
defaultValue={podcastTitle}
|
defaultValue={userPromt}
|
||||||
className="w-full rounded-md border border-slate-400/40 p-2"
|
className="w-full rounded-md border border-slate-400/40 p-2"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setPodcastTitle(e.target.value);
|
setUserPrompt(e.target.value);
|
||||||
}}
|
}}
|
||||||
></textarea>
|
></textarea>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ export const getPodcastByChatId = async (chatId: string, authToken: string) => {
|
||||||
|
|
||||||
export const generatePodcast = async (request: GeneratePodcastRequest, authToken: string) => {
|
export const generatePodcast = async (request: GeneratePodcastRequest, authToken: string) => {
|
||||||
try {
|
try {
|
||||||
const { podcast_title = "SurfSense Podcast" } = request;
|
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL}/api/v1/podcasts/generate/`,
|
`${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}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
"Content-Type": "application/json",
|
"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