Skip to content

Commit 4907897

Browse files
committed
AIの回答時にそのチャットのページを開く
1 parent b4f8a52 commit 4907897

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

app/(docs)/@docs/[lang]/[pageId]/chatForm.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useEmbedContext } from "@/terminal/embedContext";
1212
import { useChatHistoryContext } from "./chatHistory";
1313
import { askAI } from "@/actions/chatActions";
1414
import { PagePath } from "@/lib/docs";
15+
import { useRouter } from "next/navigation";
1516

1617
interface ChatFormProps {
1718
path: PagePath;
@@ -31,6 +32,8 @@ export function ChatForm({ path, sectionContent, close }: ChatFormProps) {
3132

3233
const { files, replOutputs, execResults } = useEmbedContext();
3334

35+
const router = useRouter();
36+
3437
// const documentContentInView = sectionContent
3538
// .filter((s) => s.inView)
3639
// .map((s) => s.rawContent)
@@ -91,6 +94,7 @@ export function ChatForm({ path, sectionContent, close }: ChatFormProps) {
9194
document.getElementById(result.chat.sectionId)?.scrollIntoView({
9295
behavior: "smooth",
9396
});
97+
router.push(`/chat/${result.chat.chatId}`, { scroll: false });
9498
setInputValue("");
9599
close();
96100
}

0 commit comments

Comments
 (0)