feat: add AI Chat block with contextual prompting and persistence#6
Closed
feat: add AI Chat block with contextual prompting and persistence#6
Conversation
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.
Motivation
Description
chatblock type and UIAIChatBlockcomponent with prompt input, checkboxes forInclude selected blocksandExpand linked nodes (depth 1), assistant response display, and local styling (ai-chat-block.css).chatin block type unions and the Add Block modal, registerAIChatBlockinProjectCanvasandPublicProjectCanvas, and passallBlocks/allLinksinto nodedataso the block can assemble selected context and linked-node expansion.metadata.messagesand initialize chat metadata defaults (includeSelectedContext: true,expandLinkedNodes: false) when creating new chat blocks.POST /api/ai/chatthat acceptsprompt+ assembledcontext, calls the OpenAI Responses API whenOPENAI_API_KEYis configured, and returns a harmless fallback message when the key is not set.blocksDB type union to includechat, and add migration34AddChatBlockType.tsto allowchatas a validblockType.en.json,fr.json, andit.json.Testing
npm run -s checkwhich succeeded.npm run -s test -- src/app/lib/graph.test.tswhich passed.vitest run) failed in this environment with an existing local sqlite migration/test DB error (SqliteError: no such table: main.blocks_old), so the broader CI-style test run did not complete here due to that database state issue.Codex Task