Skip to content

Conversation

@na-trium-144
Copy link
Contributor

@na-trium-144 na-trium-144 commented Oct 19, 2025

close #58
close #55
close #24
close #57
close #56

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 19, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@na-trium-144 na-trium-144 requested a review from Copilot October 24, 2025 09:22
Copy link

Copilot AI left a 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 FileProvider with EmbedContextProvider to 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.

Comment on lines +136 to 137
console.log(prompt);

Copy link

Copilot AI Oct 24, 2025

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.

Suggested change
console.log(prompt);

Copilot uses AI. Check for mistakes.
};
updateChatHistory([userMessage, errorMessage]);
console.log(result.error);
// TODO: ユーザーに表示
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: chatエラーメッセージをユーザーに表示
(たぶん正常時のaddChat()と別で、チャット入力欄のところに表示したほうがいいと思う)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#62

updateChatHistory([userMessage, aiMessage]);
const aiMessage: ChatMessage = { sender: "ai", text: result.response };
const chatId = addChat(result.targetSectionId, [userMessage, aiMessage]);
// TODO: chatIdが指す対象の回答にフォーカス
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: chatIdが指す対象の回答にフォーカス

pcの場合はそこに自動スクロールで、モバイル表示のときはチャットは別ページになるのかな?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#63

return {
response: text,
error: null,
// TODO: どのセクションへの回答にするかをAIに決めさせる
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: どのセクションへの回答にするかをAIに決めさせる

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#64

<StyledMarkdown content={section.content} />
</div>
<div key={`${index}-chat`}>
{/* 右側に表示するチャット履歴欄 */}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: レスポンシブ対応

  • モバイルではチャットを別ページで表示する
  • モバイルでなくても別ページ or モーダルで表示するボタンを追加したほうがよさそう
  • いきなりチャットの内容を表示する前に「このセクションのチャット一覧」が要るかも?accordion的なものでも良い?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment