チャット再生成 - #235
Draft
na-trium-144 wants to merge 7 commits into
Draft
Conversation
これからエラーハンドリングをサーバー側で書くため
1. **`applyChatDiff` / `getChatFromCache` の共通化** ([`app/lib/chatHistory.ts`](file:///Users/kou/projects/my-code/app/lib/chatHistory.ts)) - `applyChatDiff` および `getChatFromCache` を共通ライブラリ `chatHistory.ts` に配置・export し、Server Component から安全に再利用できるように整備しました。 2. **対象チャットより前の diff のみを適用したドキュメント状態の算出** - チャットページ表示時(Server Component)にて、対象ページの全チャット履歴を取得。 - 再生成対象のチャットの作成日時 (`createdAt`) よりも**古い**チャットの履歴のみを抽出 (`priorChatHistories`)。 - `applyChatDiff(sections, priorChatHistories)` を実行し、**「そのチャットが作成された時点のドキュメント内容」**(=対象チャット以降の diff は適用されていない過去状態)を正確に復元した `priorSectionContent` を計算・生成しました。 3. **再生成リクエスト時のプロンプト適用** - 「再生成」ボタン押下時に、復元された `priorSectionContent` をそのまま `/api/chat` へ送信するように更新しました。 これにより、チャット再生成時に「対象チャットより前の時刻に作られた diff だけが適用された正確なドキュメントテキスト」に基づいて AI 回答・差分生成が行われます。
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | 83f70f0 | Commit Preview URL Branch Preview URL |
Aug 09 2026, 05:21 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
193の要件