Skip to content

feat: add prompt and context props to AiPanelContent and export its type#800

Merged
surajair merged 4 commits intodevfrom
ai-context
Mar 13, 2026
Merged

feat: add prompt and context props to AiPanelContent and export its type#800
surajair merged 4 commits intodevfrom
ai-context

Conversation

@amitdhiman5086
Copy link
Copy Markdown
Contributor

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 12, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: sdk.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 12, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

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

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
sdk-nextjs 25676f3 Mar 13 2026, 05:30 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 12, 2026

Deploying sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 25676f3
Status: ✅  Deploy successful!
Preview URL: https://56fa4e9c.sdk-8n4.pages.dev
Branch Preview URL: https://ai-context.sdk-8n4.pages.dev

View logs

Copy link
Copy Markdown
Contributor

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

Adds support for passing structured “AI context” (site/page metadata) from the AI panel through the ASK_AI action to influence the server-side system prompt.

Changes:

  • Introduces a new AIContext type and threads it through AIChatOptions / AIConfig / AiPanelContentProps.
  • Forwards context from the AI panel requests into the ASK_AI action and ChaiAIChatHandler.
  • Extends getAskAiSystemPrompt() to append serialized site/page context into the system prompt.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/types/actions.ts Adds AIContext and attaches it to AIChatOptions.
src/pages/panels/ai-panel/ai-panel-other-lang.tsx Includes config.context in ASK_AI request body for translation/update flows.
src/pages/panels/ai-panel/ai-panel-default-lang.tsx Includes config.context in ASK_AI request body for default-language flow.
src/pages/panels/ai-panel/ai-panel-content.tsx Exposes context on AiPanelContentProps and injects it into the AI config provider.
src/pages/panels/ai-panel/ai-models-context.tsx Extends AIConfig to carry optional context.
src/pages/index.ts Re-exports AiPanelContentProps as ChaiAiPanelProps.
src/actions/classes/system-prompt.ts Updates getAskAiSystemPrompt() to accept context and append it to the prompt.
src/actions/classes/chai-ai-chat-handler.ts Plumbs context into getAskAiSystemPrompt(); refactors image-message assembly formatting.
src/actions/builder/ask-ai-action.ts Changes context type to AIContext and forwards it to the chat handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/actions/classes/system-prompt.ts Outdated
Comment thread src/actions/classes/system-prompt.ts Outdated
Comment thread src/actions/classes/chai-ai-chat-handler.ts
Comment thread src/pages/panels/ai-panel/ai-panel-default-lang.tsx
Comment thread src/pages/panels/ai-panel/ai-panel-other-lang.tsx
Copy link
Copy Markdown
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread src/pages/panels/ai-panel/ai-models-context.tsx Outdated
@surajair surajair merged commit cc4cca0 into dev Mar 13, 2026
1 of 3 checks passed
@surajair surajair deleted the ai-context branch March 13, 2026 06:05
surajair added a commit that referenced this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants