-
Notifications
You must be signed in to change notification settings - Fork 1
画面内のセクションを取得する機能を追加 #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | 66fc13f | Commit Preview URL Branch Preview URL |
Oct 24 2025, 10:50 AM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to track which sections are currently visible in the viewport and refactors context management to consolidate file and terminal state. The main purpose is to enhance the AI chat feature by providing context about which sections the user is viewing.
Key changes:
- Replaced
FileProviderwithEmbedContextProviderto manage files, terminal outputs, and execution results in one place - Added viewport tracking to determine which markdown sections are currently visible
- Restructured chat functionality to leverage section visibility information
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app/terminal/embedContext.tsx | New context provider consolidating file, REPL output, and execution result management |
| app/terminal/file.tsx | Removed file-only context (replaced by embedContext) |
| app/[docs_id]/section.tsx | Removed section-level component (logic moved to pageContent) |
| app/[docs_id]/pageContent.tsx | New component handling viewport tracking and section rendering |
| app/[docs_id]/chatHistory.tsx | New context provider for managing chat history across sections |
| app/actions/chatActions.ts | Updated to use section visibility information in AI prompts |
| app/terminal/python/embedded.tsx | Added terminalId prop for tracking terminal outputs |
| app/terminal/repl.tsx | Added terminalId parameter to addReplOutput calls |
| app/terminal/editor.tsx | Updated to use new embedContext |
| app/[docs_id]/markdown.tsx | Moved Heading component from section.tsx and reordered code block handling |
| app/[docs_id]/chatForm.tsx | Refactored to use new context structure and section visibility |
| app/[docs_id]/page.tsx | Updated to use new PageContent and ChatHistoryProvider components |
| app/[docs_id]/splitMarkdown.ts | Added rawContent field to preserve original markdown with headings |
| app/layout.tsx | Replaced FileProvider with EmbedContextProvider |
| app/sidebar.tsx | Added close button and updated branding |
| app/navbar.tsx | Made navbar fixed and updated branding |
| app/[docs_id]/themeToggle.tsx | Updated styling for better alignment |
| app/hooks/useChathistory.ts | Removed (replaced by chatHistory.tsx) |
| app/[docs_id]/chatServer.ts | Removed empty file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| console.log(prompt); | ||
|
|
Copilot
AI
Oct 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log statement should be removed before production.
| console.log(prompt); |
| }; | ||
| updateChatHistory([userMessage, errorMessage]); | ||
| console.log(result.error); | ||
| // TODO: ユーザーに表示 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: chatエラーメッセージをユーザーに表示
(たぶん正常時のaddChat()と別で、チャット入力欄のところに表示したほうがいいと思う)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| updateChatHistory([userMessage, aiMessage]); | ||
| const aiMessage: ChatMessage = { sender: "ai", text: result.response }; | ||
| const chatId = addChat(result.targetSectionId, [userMessage, aiMessage]); | ||
| // TODO: chatIdが指す対象の回答にフォーカス |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: chatIdが指す対象の回答にフォーカス
pcの場合はそこに自動スクロールで、モバイル表示のときはチャットは別ページになるのかな?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return { | ||
| response: text, | ||
| error: null, | ||
| // TODO: どのセクションへの回答にするかをAIに決めさせる |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: どのセクションへの回答にするかをAIに決めさせる
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <StyledMarkdown content={section.content} /> | ||
| </div> | ||
| <div key={`${index}-chat`}> | ||
| {/* 右側に表示するチャット履歴欄 */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: レスポンシブ対応
- モバイルではチャットを別ページで表示する
- モバイルでなくても別ページ or モーダルで表示するボタンを追加したほうがよさそう
- いきなりチャットの内容を表示する前に「このセクションのチャット一覧」が要るかも?accordion的なものでも良い?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close #58
close #55
close #24
close #57
close #56