File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import clsx from "clsx";
1111// MarkdownSectionに追加で、ユーザーが今そのセクションを読んでいるかどうか、などの動的な情報を持たせる
1212export type DynamicMarkdownSection = MarkdownSection & {
1313 inView : boolean ;
14- sectionId : string ;
1514} ;
1615
1716interface PageContentProps {
@@ -26,19 +25,17 @@ export function PageContent(props: PageContentProps) {
2625 const [ dynamicMdContent , setDynamicMdContent ] = useState <
2726 DynamicMarkdownSection [ ]
2827 > (
29- props . splitMdContent . map ( ( section , i ) => ( {
28+ props . splitMdContent . map ( ( section ) => ( {
3029 ...section ,
3130 inView : false ,
32- sectionId : section . id || `${ props . docs_id } -${ i } ` ,
3331 } ) )
3432 ) ;
3533
3634 useEffect ( ( ) => {
3735 // props.splitMdContentが変わったときにローカルstateとcontextの両方を更新
38- const newContent = props . splitMdContent . map ( ( section , i ) => ( {
36+ const newContent = props . splitMdContent . map ( ( section ) => ( {
3937 ...section ,
4038 inView : false ,
41- sectionId : section . id || `${ props . docs_id } -${ i } ` ,
4239 } ) ) ;
4340 setDynamicMdContent ( newContent ) ;
4441 setSidebarMdContent ( props . docs_id , newContent ) ;
@@ -104,7 +101,7 @@ export function PageContent(props: PageContentProps) {
104101 < div >
105102 { /* 右側に表示するチャット履歴欄 */ }
106103 { chatHistories
107- . filter ( ( c ) => c . sectionId === section . sectionId )
104+ . filter ( ( c ) => c . sectionId === section . id )
108105 . map ( ( { chatId, messages } ) => (
109106 < div
110107 key = { chatId }
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ export async function askAI(params: ChatParams): Promise<ChatResult> {
149149 }
150150 // TODO: どのセクションへの回答にするかをAIに決めさせる
151151 const targetSectionId =
152- sectionContent . find ( ( s ) => s . inView ) ?. sectionId || "" ;
152+ sectionContent . find ( ( s ) => s . inView ) ?. id || "" ;
153153 const newChat = await addChat ( params . docsId , targetSectionId , [
154154 { role : "user" , content : userQuestion } ,
155155 { role : "ai" , content : text } ,
You can’t perform that action at this time.
0 commit comments