Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Aug 25, 2025


PR-Codex overview

This PR focuses on renaming and updating references from "Chat API" to "Blockchain LLM" across multiple files, as well as making changes to the data structure of NebulaTxData and enhancing the transaction execution features in the application.

Detailed summary

  • Changed label and name from "Chat API" to "Blockchain LLM" in navLinks.ts, Header.tsx, and sidebar.tsx.
  • Updated chainId to chain_id in NebulaTxData type in types.ts and ChatPageContent.tsx.
  • Modified API descriptions to reflect the new focus on "Blockchain LLM".
  • Enhanced transaction execution features in execution/page.mdx.
  • Updated event handling in streaming/page.mdx to use parsed event data.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • Documentation

    • Added a "Transaction Execution" page with examples for Auto Execute and Prepare-for-Signing.
    • Renamed and updated "Chat API" docs to "Blockchain LLM", clarifying execute-or-prepare capabilities.
  • Style

    • Updated UI labels and page title from "Chat API" to "Blockchain LLM" across navigation, headers, sidebar, playground, and landing.
    • Added a "Transaction Execution" sidebar link.
  • Compatibility

    • Transaction payload field renamed to chain_id and value made required.
    • Streaming and playground now expect structured action payloads (including monitor_transaction) instead of JSON-encoded strings.

@vercel vercel bot temporarily deployed to Preview – nebula August 25, 2025 08:46 Inactive
@vercel
Copy link

vercel bot commented Aug 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Aug 26, 2025 9:55am
thirdweb_playground Ready Ready Preview Comment Aug 26, 2025 9:55am
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
nebula Skipped Skipped Aug 26, 2025 9:55am
thirdweb-www Skipped Skipped Aug 26, 2025 9:55am
wallet-ui Skipped Skipped Aug 26, 2025 9:55am

@vercel vercel bot temporarily deployed to Preview – wallet-ui August 25, 2025 08:46 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www August 25, 2025 08:46 Inactive
@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2025

⚠️ No Changeset found

Latest commit: b1f20d0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 25, 2025

Walkthrough

Updated UI labels from "Chat API" to "Blockchain LLM"; added a Transaction Execution docs page; renamed NebulaTxData.chainId → chain_id and made value required; removed runtime JSON.parse for action data and shifted SSE payloads to structured objects; propagated chain_id across client and UI code.

Changes

Cohort / File(s) Summary
Branding / label updates
apps/playground-web/src/app/ai/chat/page.tsx, apps/playground-web/src/app/navLinks.ts, apps/portal/src/app/Header.tsx, apps/portal/src/app/ai/chat/page.mdx, apps/portal/src/app/page.tsx, apps/portal/src/app/ai/sidebar.tsx
Renamed displayed title/labels from “Chat API” to “Blockchain LLM” across playground and portal UIs; no URL or control-flow changes.
Docs: Transaction Execution (new)
apps/portal/src/app/ai/chat/execution/page.mdx
Added documentation for POST /ai/chat execution modes (Auto Execute vs Prepare for Signing) with request/response examples, auth notes, and example actions (monitor_transaction, sign_transaction).
Sidebar addition
apps/portal/src/app/ai/sidebar.tsx
Added new nested link "Transaction Execution" at /ai/chat/execution and adjusted ordering; first AI submenu link renamed to “Blockchain LLM”.
Type changes: NebulaTxData
apps/playground-web/src/app/ai/api/types.ts
Renamed field chainId: numberchain_id: number; changed value?: stringvalue: string (now required).
Runtime parsing: SSE / streaming handler
apps/portal/src/app/ai/chat/streaming/page.mdx
Switched from string-encoded SSE payloads to structured objects: parse event.data once into parsedEventData; removed inner JSON.parse calls; added handling for monitor_transaction action and use parsedEventData.data for image/action payloads.
Runtime parsing: client chat API
apps/playground-web/src/app/ai/api/chat.ts
Removed JSON.parse of action payloads for sign_transaction and sign_swap; treat data.data as already-typed objects (NebulaTxData / NebulaSwapData).
Chat UI: chain field propagation
apps/playground-web/src/app/ai/components/ChatPageContent.tsx
Updated all usages to message.data.chain_id (instead of chainId) for sign_transaction/sign_swap flows, emitted transaction payloads, and ConnectButton chain prop; adjusted emitted payloads to include chain_id.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client (Playground)
  participant API as AI Chat API (/ai/chat)
  participant W as Wallet/Auth
  participant CH as Blockchain

  rect rgb(240,248,255)
  note over C,API: Prepare for Signing (auto_execute=false/omitted)
  C->>API: POST /ai/chat {messages, context}
  API-->>C: 200 OK {actions: [sign_transaction (prepared data)...], message, session_id, request_id}
  end

  rect rgb(245,255,240)
  note over C,CH: Auto Execute (auto_execute=true)
  C->>API: POST /ai/chat {messages, context{from, auto_execute_transaction:true, chain_ids...}}
  API->>W: Validate auth (x-secret-key or Authorization)
  API->>CH: Submit transaction(s)
  CH-->>API: Tx result(s)
  API-->>C: 200 OK {actions: [monitor_transaction{transaction_id}...], message, session_id, request_id}
  alt auth error or execution failure
    API-->>C: 4xx/5xx {error}
  end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _AI_Rename_Chat_API_to_Blockchain_LLM_and_add_transaction_execution_docs

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Playground Changes involving the Playground codebase. Portal Involves changes to the Portal (docs) codebase. labels Aug 25, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@joaquim-verges joaquim-verges changed the title [AI] Rename Chat API to Blockchain LLM and add transaction execution docs [Docs] Rename Chat API to Blockchain LLM and add transaction execution docs Aug 25, 2025
@joaquim-verges joaquim-verges marked this pull request as ready for review August 25, 2025 08:46
@joaquim-verges joaquim-verges requested review from a team as code owners August 25, 2025 08:46
@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.53%. Comparing base (bdcbe0e) to head (46ea117).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7904   +/-   ##
=======================================
  Coverage   56.53%   56.53%           
=======================================
  Files         904      904           
  Lines       58592    58592           
  Branches     4143     4143           
=======================================
  Hits        33126    33126           
  Misses      25360    25360           
  Partials      106      106           
Flag Coverage Δ
packages 56.53% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 25, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.06 KB (0%) 1.3 s (0%) 241 ms (+188.38% 🔺) 1.6 s
thirdweb (cjs) 357.05 KB (0%) 7.2 s (0%) 689 ms (+15.44% 🔺) 7.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 70 ms (+1287.49% 🔺) 185 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 61 ms (+3217.82% 🔺) 72 ms
thirdweb/react (minimal + tree-shaking) 19.15 KB (0%) 383 ms (0%) 84 ms (+639.32% 🔺) 467 ms

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (10)
apps/playground-web/src/app/navLinks.ts (1)

13-24: Avoid drift by centralizing the AI route/label.

This label/href pair is duplicated across multiple files in this PR. Consider exporting a shared constant (e.g., AI_CHAT = { href: "/ai/chat", name: "Blockchain LLM" }) from a small routes module used by both portal and playground to keep labels in sync.

-  links: [
-    {
-      href: "/ai/chat",
-      label: "Blockchain LLM",
-    },
-  ],
+  links: [
+    {
+      href: AI_CHAT.href,
+      label: AI_CHAT.name,
+    },
+  ],

If helpful, I can draft a tiny shared routes file under apps/*/src/app/ai/routes.ts to house this.

apps/portal/src/app/Header.tsx (2)

144-158: Deduplicate AI menu source to prevent future inconsistencies.

aiLinks is defined here, while similar labels/links live in other files (sidebar, homepage, playground). Consider centralizing in a shared nav config.

-const aiLinks = [
+import { AI_CHAT } from "../ai/routes"; // example shared module
+const aiLinks = [
   {
-    href: "/ai/chat",
-    name: "Blockchain LLM",
+    href: AI_CHAT.href,
+    name: AI_CHAT.name,
   },

I can follow up with a small shared module PR if you want.


154-156: Inconsistent capitalization with “LLMs.txt”.

Header uses “LLMs.txt” (capitalized), while apps/portal/src/app/ai/sidebar.tsx uses “llms.txt”. Standardize one variant sitewide.

-    name: "LLMs.txt",
+    name: "llms.txt",

Or update the sidebar to “LLMs.txt” instead.

apps/portal/src/app/ai/sidebar.tsx (1)

41-44: Standardize “llms.txt” label capitalization with Header menu.

Header uses “LLMs.txt”; here it’s “llms.txt”. Pick one and apply everywhere.

-      name: "llms.txt",
+      name: "LLMs.txt",
apps/playground-web/src/app/ai/chat/page.tsx (1)

15-18: Metadata title updated to “Blockchain LLM - Playground” — OK.

Consider typing Next.js metadata for clarity and editor hints.

-export const metadata = {
+export const metadata: Metadata = {
   title: "Blockchain LLM - Playground",
   description: "Chat with thirdweb AI for blockchain interactions",
 };

Add import at top of file:

import type { Metadata } from "next";
apps/portal/src/app/ai/chat/page.mdx (1)

10-11: Align bullets with new execution docs by adding a direct link

Since you now support “Execute or prepare …” flows and added a dedicated Execution page, add a quick cross-link here to aid discovery.

Apply this diff near “Going further”:

 ### Going further

-- [Handle streaming responses](/ai/chat/streaming)
-- [Full API Reference](https://api.thirdweb.com/reference#tag/ai/post/ai/chat)
+- [Handle streaming responses](/ai/chat/streaming)
+- [Transaction Execution](/ai/chat/execution)
+- [Full API Reference](https://api.thirdweb.com/reference#tag/ai/post/ai/chat)
apps/portal/src/app/ai/chat/execution/page.mdx (4)

18-21: Tighten auth wording and fix article “a” → “an” before Authorization

Clarifies headers, fixes grammar, and adds explicit Bearer usage.

Apply this diff:

-- The API must be called with either:
-  - your `x-secret-key` header for server wallet authentication
-  - OR a `Authorization` header with a valid wallet JWT for user wallet authentication
+- Call the API with either:
+  - `x-secret-key: <PROJECT_SECRET_KEY>` (server-side only)
+  - or `Authorization: Bearer <WALLET_JWT>` (user wallet)
+
+> Warning: Never expose `x-secret-key` in client-side code or browsers. Use it only from trusted server environments.

24-41: Example LGTM, minor suggestion: clarify empty actions on auto-execute

For auto-execute responses, consider a one-liner note that actions will typically be empty because the transaction was already submitted.

You can append a short note after the example: “Note: In auto-execute mode, the actions array is often empty because the transaction has been submitted.”


49-49: Add a concrete “Prepare for Signing” example with a prepared action

Showing the shape of a prepared action reduces guesswork for integrators.

Apply this diff:

-<OpenApiEndpoint path="/ai/chat" method="POST" />
+<OpenApiEndpoint
+  path="/ai/chat"
+  method="POST"
+  requestBodyOverride={{
+    "messages": [
+      { "role": "user", "content": "Prepare a USDC transfer of 10 to vitalik.eth" }
+    ],
+    "context": {
+      "from": "0x...",
+      "auto_execute_transaction": false,
+      "chain_ids": [8453]
+    }
+  }}
+  responseExampleOverride={{
+    "message": "Prepared a transaction for your review.",
+    "session_id": "123",
+    "request_id": "456",
+    "actions": [
+      {
+        "type": "transaction",
+        "chain_id": 8453,
+        "to": "0x...",
+        "data": "0x...",
+        "value": "0x0",
+        "description": "USDC transfer to vitalik.eth (10 USDC)"
+      }
+    ]
+  }}
+/>

14-17: Minor editorial cleanups

  • Consider “(optional)” lowercase for consistency with your other docs.
  • “chain IDs to execute the transaction on” could be “chain IDs to execute on” for brevity.

Would you like me to sweep adjacent AI docs for these micro-edits to keep tone/terminology consistent?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bdcbe0e and 5d9b23d.

📒 Files selected for processing (7)
  • apps/playground-web/src/app/ai/chat/page.tsx (1 hunks)
  • apps/playground-web/src/app/navLinks.ts (1 hunks)
  • apps/portal/src/app/Header.tsx (1 hunks)
  • apps/portal/src/app/ai/chat/execution/page.mdx (1 hunks)
  • apps/portal/src/app/ai/chat/page.mdx (1 hunks)
  • apps/portal/src/app/ai/sidebar.tsx (2 hunks)
  • apps/portal/src/app/page.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/portal/src/app/page.tsx
  • apps/playground-web/src/app/navLinks.ts
  • apps/portal/src/app/ai/sidebar.tsx
  • apps/playground-web/src/app/ai/chat/page.tsx
  • apps/portal/src/app/Header.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/portal/src/app/page.tsx
  • apps/playground-web/src/app/navLinks.ts
  • apps/portal/src/app/ai/sidebar.tsx
  • apps/playground-web/src/app/ai/chat/page.tsx
  • apps/portal/src/app/Header.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/playground-web/src/app/navLinks.ts
  • apps/playground-web/src/app/ai/chat/page.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Use `NavLink` for internal navigation with automatic active states in dashboard and playground apps

Applied to files:

  • apps/playground-web/src/app/navLinks.ts
🪛 LanguageTool
apps/portal/src/app/ai/chat/execution/page.mdx

[grammar] ~16-~16: There might be a mistake here.
Context: ...m - auto_execute_transaction set to true - (Optional) chain_ids set to the chain ...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... chain IDs to execute the transaction on - The API must be called with either: - ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...on - The API must be called with either: - your x-secret-key header for server wa...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ... header for server wallet authentication - OR a Authorization header with a valid...

(QB_NEW_EN)


[grammar] ~38-~38: There might be a mistake here.
Context: ... a few seconds.", "session_id": "123", "request_id": "456", "actions": [] }} ...

(QB_NEW_EN)


[grammar] ~39-~39: There might be a mistake here.
Context: ...ssion_id": "123", "request_id": "456", "actions": [] }} /> ## Prepare for Sign...

(QB_NEW_EN)


[grammar] ~40-~40: There might be a mistake here.
Context: ..., "request_id": "456", "actions": [] }} /> ## Prepare for Signing When the ...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
apps/playground-web/src/app/navLinks.ts (1)

20-23: Rename to “Blockchain LLM” is correct and consistent with PR scope.

Href remains /ai/chat and only the label changed. Looks good.

apps/portal/src/app/page.tsx (1)

83-89: Homepage card title updated to “Blockchain LLM” — OK.

Copy, href (/ai/chat), and icon remain aligned. No issues.

apps/portal/src/app/Header.tsx (1)

144-149: Header AI menu label updated to “Blockchain LLM” — OK.

The rename matches sidebar and cards. Href unchanged.

apps/portal/src/app/ai/sidebar.tsx (1)

5-12: Top-level rename to “Blockchain LLM” — OK.

Matches Header and homepage. Non-collapsible group is fine.

apps/portal/src/app/ai/chat/page.mdx (2)

3-3: Rename to “Blockchain LLM” approved and no lingering “Chat API” references found

– The page title in apps/portal/src/app/ai/chat/page.mdx has been updated to

# Blockchain LLM

as intended.
– Ran a case-insensitive search for “Chat API” across the repo (excluding lockfiles and node_modules); no occurrences remain.

Everything looks good—no further action needed.


54-55: Please verify the “Full API Reference” link for the POST /ai/chat endpoint

I wasn’t able to confirm whether the current docs slug for POST /ai/chat on api.thirdweb.com changed after the recent reorganization. Before merging, please:

  • Open apps/portal/src/app/ai/chat/page.mdx at lines 54–55
  • Ensure the URL in the “Full API Reference” link matches the live documentation path
  • If the slug has changed (e.g. moved under /docs or renamed), update the markdown accordingly

Once you’ve confirmed the correct URL, please update or approve this link.

Comment on lines +14 to +21
- The context object must be set with:
- `from` set to the wallet address to execute the transaction from
- `auto_execute_transaction` set to `true`
- (Optional) `chain_ids` set to the chain IDs to execute the transaction on
- The API must be called with either:
- your `x-secret-key` header for server wallet authentication
- OR a `Authorization` header with a valid wallet JWT for user wallet authentication

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm header names and JWT format across the codebase

Ensure you’re consistently using exactly x-secret-key and Authorization: Bearer <token> in all AI docs and examples (Playground, Portal, SDK README).


🏁 Script executed:

#!/usr/bin/env bash
# Verify consistent header naming across docs and app sources
rg -nP -C2 '(x-secret-key|Authorization:?\s*Bearer)' apps/portal apps/playground-web packages --type-not=lock --hidden

Length of output: 74588


🏁 Script executed:

#!/usr/bin/env bash

# Show first 40 lines of the execution docs to confirm how Authorization is described
sed -n '1,40p' apps/portal/src/app/ai/chat/execution/page.mdx

# Show the streaming docs to see if JWT auth is mentioned or needs to be added
sed -n '60,100p' apps/portal/src/app/ai/chat/streaming/page.mdx

Length of output: 2494


Consistent Authorization: Bearer header in AI chat docs

The AI chat execution docs still reference a generic Authorization header without the Bearer prefix, and the code examples don’t explicitly show it. Please update the following:

  • apps/portal/src/app/ai/chat/execution/page.mdx
    • Change “OR a Authorization header with a valid wallet JWT”
    to
    “OR an Authorization: Bearer <YOUR_WALLET_JWT> header with a valid wallet JWT”
    • In the <OpenApiEndpoint> example, add a headers override:
    <OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={…} responseExampleOverride={…}
    ->
    + components={{
    +   request: {
    +     headers: {
    +       "x-secret-key": "<YOUR_SECRET_KEY>",
    +       "Authorization": "Bearer <YOUR_WALLET_JWT>"
    +     }
    +   }
    + }}
    />
  • apps/portal/src/app/ai/chat/streaming/page.mdx
    • If the streaming endpoint supports user‐wallet authentication, add a note and example:
    - Headers:
    -   - `x-secret-key`: `<your-secret-key>`
    + Headers (server OR user auth):
    +   - `x-secret-key`: `<your-secret-key>`  
    +   OR  
    +   - `Authorization: Bearer <YOUR_WALLET_JWT>`
  • Playground and SDK README
    • Verify that all AI/chat examples use exactly
    x-secret-key for server calls
    and
    Authorization: Bearer <token> for user calls.

This will ensure all AI docs and samples are aligned.

🧰 Tools
🪛 LanguageTool

[grammar] ~16-~16: There might be a mistake here.
Context: ...m - auto_execute_transaction set to true - (Optional) chain_ids set to the chain ...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... chain IDs to execute the transaction on - The API must be called with either: - ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...on - The API must be called with either: - your x-secret-key header for server wa...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ... header for server wallet authentication - OR a Authorization header with a valid...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In apps/portal/src/app/ai/chat/execution/page.mdx around lines 14-21, the docs
reference a generic Authorization header and lack explicit examples; update the
sentence to read “OR an Authorization: Bearer <YOUR_WALLET_JWT> header with a
valid wallet JWT”, and modify the <OpenApiEndpoint> example to include a headers
override that demonstrates either x-secret-key or Authorization: Bearer
<YOUR_WALLET_JWT>; also update apps/portal/src/app/ai/chat/streaming/page.mdx to
note support for user-wallet authentication and replace the headers block with a
“Headers (server OR user auth):” example showing x-secret-key OR Authorization:
Bearer <YOUR_WALLET_JWT>; finally, scan Playground and SDK README examples to
ensure all AI/chat samples consistently use x-secret-key for server calls and
Authorization: Bearer <token> for user calls, correcting any mismatches.

@joaquim-verges joaquim-verges force-pushed the _AI_Rename_Chat_API_to_Blockchain_LLM_and_add_transaction_execution_docs branch from 5d9b23d to 69c2064 Compare August 25, 2025 22:39
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 25, 2025 22:39 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www August 25, 2025 22:39 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula August 25, 2025 22:39 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
apps/portal/src/app/ai/chat/execution/page.mdx (2)

14-21: Use “Authorization: Bearer …” and fix the article “an”, plus show headers in the example

These lines should explicitly show the Bearer scheme and correct grammar. Also mirror the headers in the example for copy-pasteability. This aligns with prior guidance and existing comments.

 - The API must be called with either:
   - your `x-secret-key` header for server wallet authentication
-  - OR a `Authorization` header with a valid wallet JWT for user wallet authentication
+  - OR an `Authorization: Bearer <YOUR_WALLET_JWT>` header for user wallet authentication
@@
-<OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={{
+<OpenApiEndpoint
+  path="/ai/chat"
+  method="POST"
+  components={{
+    request: {
+      headers: {
+        "x-secret-key": "<YOUR_SECRET_KEY>",
+        "Authorization": "Bearer <YOUR_WALLET_JWT>"
+      }
+    }
+  }}
+  requestBodyOverride={{
   "messages": [
     {
       "role": "user",
       "content": "Transfer 10 USDC to vitalik.eth"
     }
   ],
   "context": {
     "from": "0x...",
     "auto_execute_transaction": true,
     "chain_ids": [8453]
   }
-}} responseExampleOverride={{
+}} 
+  responseExampleOverride={{
   "message": "I've sent 10 USDC to Vitalik's wallet with transaction ID 11cd95e3-c0ee-4468-97c1-fd05dc919cdb. It should be confirmed in a few seconds.",
   "session_id": "123",
   "request_id": "456",
   "actions": [{
     "session_id": "8d1bfac4-e6c0-473b-bbb6-649f459d37e6",
     "request_id": "79066871-b86f-4814-8027-5f34d99df389",
     "source": "model",
     "type": "monitor_transaction",
     "data": {
         "transaction_id": "11cd95e3-c0ee-4468-97c1-fd05dc919cdb"
     }
   }]
-}} />
+}} 
+/>

55-57: Use the same parameter name: auto_execute_transaction

This line uses auto_execute, which diverges from the rest of the page and the examples.

-When the `auto_execute` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a 'sign_transaction' action type.
+When the `auto_execute_transaction` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a `sign_transaction` action type.
🧹 Nitpick comments (5)
apps/portal/src/app/ai/chat/page.mdx (3)

9-9: Tighten copy for clarity and consistency

  • Prefer “between any token pair” over “from/to any token pair”.
  • Add the serial comma in “balances, prices, and metadata” (house style consistency with other docs).
- - Fetch token balances, prices and metadata
+ - Fetch token balances, prices, and metadata
@@
- - Execute or prepare swaps from/to any token pair
+ - Execute or prepare swaps between any token pair

Also applies to: 11-11


33-45: Optionally show auto-execute in the quick-start sample

Given this page now advertises “Execute or prepare…”, consider demonstrating auto-execution by including the flag in the OpenAI client example. Readers who only skim this page will succeed without having to discover the execution subpage.

 chat_completion = client.chat.completions.create(
   model="t0",
   messages=[{"role": "user", "content": "Transfer 10 USDC to vitalik.eth"}],
   stream=False,
-    extra_body={ "context": { "from": "0x...", "chain_ids": [8453] }}
+    extra_body={ "context": { "from": "0x...", "chain_ids": [8453], "auto_execute_transaction": True } }
 )

Note: The execution page already documents auth requirements; a brief inline note such as “Requires x-secret-key or Authorization: Bearer ” below the snippet would further set expectations.


52-55: Cross-link to the new Transaction Execution docs

Add a “Transaction Execution” bullet so users can discover the deeper flow from here.

 ### Going further

+- [Transaction Execution](/ai/chat/execution)
 - [Handle streaming responses](/ai/chat/streaming)
 - [Full API Reference](https://api.thirdweb.com/reference#tag/ai/post/ai/chat)
apps/portal/src/app/ai/chat/execution/page.mdx (2)

5-8: Hyphenate “auto‑execute” for readability

Minor copy polish: “auto‑execute” as a compound verb is easier to scan; likewise “auto‑execution” when used as a noun.

-thirdweb AI can either auto execute transactions or prepare them for signing.
+thirdweb AI can either auto‑execute transactions or prepare them for signing.
@@
-- **Auto Execute**: The API will auto execute the transaction. Requires wallet authentication.
+- **Auto‑execute**: The API will auto‑execute the transaction. Requires wallet authentication.
-- **Prepare for Signing**: The API will only prepare the transaction for signing. The user will need to sign the transaction manually.
+- **Prepare for signing**: The API will only prepare the transaction for signing. The user will need to sign the transaction manually.

59-59: Show a concrete prepare‑for‑signing response

Add a response example so users can see what to pass to their signer. This reduces guesswork and support load.

-<OpenApiEndpoint path="/ai/chat" method="POST" />
+<OpenApiEndpoint
+  path="/ai/chat"
+  method="POST"
+  requestBodyOverride={{
+    "messages": [
+      { "role": "user", "content": "Transfer 10 USDC to vitalik.eth" }
+    ],
+    "context": {
+      "from": "0x...",
+      "auto_execute_transaction": false,
+      "chain_ids": [8453]
+    }
+  }}
+  responseExampleOverride={{
+    "message": "I prepared a transaction to send 10 USDC to Vitalik. Please review and sign.",
+    "session_id": "abc",
+    "request_id": "def",
+    "actions": [
+      {
+        "source": "model",
+        "type": "sign_transaction",
+        "data": {
+          "to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
+          "value": "0",
+          "data": "0x095ea7b3...",
+          "chain_id": 8453
+        }
+      }
+    ]
+  }}
+/>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5d9b23d and 69c2064.

📒 Files selected for processing (7)
  • apps/playground-web/src/app/ai/chat/page.tsx (1 hunks)
  • apps/playground-web/src/app/navLinks.ts (1 hunks)
  • apps/portal/src/app/Header.tsx (1 hunks)
  • apps/portal/src/app/ai/chat/execution/page.mdx (1 hunks)
  • apps/portal/src/app/ai/chat/page.mdx (1 hunks)
  • apps/portal/src/app/ai/sidebar.tsx (2 hunks)
  • apps/portal/src/app/page.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/playground-web/src/app/ai/chat/page.tsx
  • apps/portal/src/app/page.tsx
  • apps/playground-web/src/app/navLinks.ts
  • apps/portal/src/app/ai/sidebar.tsx
  • apps/portal/src/app/Header.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Use `Authorization: Bearer` header – never embed tokens in URLs

Applied to files:

  • apps/portal/src/app/ai/chat/execution/page.mdx
🪛 LanguageTool
apps/portal/src/app/ai/chat/execution/page.mdx

[grammar] ~16-~16: There might be a mistake here.
Context: ...m - auto_execute_transaction set to true - (Optional) chain_ids set to the chain ...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... chain IDs to execute the transaction on - The API must be called with either: - ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...on - The API must be called with either: - your x-secret-key header for server wa...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ... header for server wallet authentication - OR a Authorization header with a valid...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...d95e3-c0ee-4468-97c1-fd05dc919cdb" } }] }} /> ## Prepare for Signing When t...

(QB_NEW_EN)


[grammar] ~52-~52: There might be a mistake here.
Context: ...e3-c0ee-4468-97c1-fd05dc919cdb" } }] }} /> ## Prepare for Signing When the ...

(QB_NEW_EN)

apps/portal/src/app/ai/chat/page.mdx

[grammar] ~7-~7: There might be a mistake here.
Context: ...Query real-time data from the blockchain - Analyze transactions - Fetch token balances, pr...

(QB_NEW_EN)


[grammar] ~11-~11: There might be a mistake here.
Context: ... or prepare swaps from/to any token pair - Deploy contracts - Generate images - Search th...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/portal/src/app/ai/chat/page.mdx (1)

3-3: Rename looks good and matches PR intent

Title update to “Blockchain LLM” aligns with the branding changes across the PR.

apps/portal/src/app/ai/chat/execution/page.mdx (1)

3-9: Solid structure and scoping

Clear separation of the two modes with a concise intro. This page rounds out the rename nicely.

@joaquim-verges joaquim-verges force-pushed the _AI_Rename_Chat_API_to_Blockchain_LLM_and_add_transaction_execution_docs branch from 69c2064 to 32584b3 Compare August 26, 2025 02:51
@vercel vercel bot temporarily deployed to Preview – nebula August 26, 2025 02:51 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 26, 2025 02:51 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www August 26, 2025 02:51 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/portal/src/app/Header.tsx (2)

470-481: Prevent reverse‑tabnabbing on external links

External links opened with target="_blank" should also set rel="noopener noreferrer". Also, pass undefined instead of an empty string for the non-external case to avoid emitting an empty target attribute.

Apply this diff:

                 <Link
                   className="before:absolute before:inset-0"
                   href={info.href}
                   prefetch={false}
-                  target={info.href.startsWith("http") ? "_blank" : ""}
+                  target={info.href.startsWith("http") ? "_blank" : undefined}
+                  rel={info.href.startsWith("http") ? "noopener noreferrer" : undefined}
                 >
                   {info.name}
                 </Link>

526-537: Do the same for NavLink’s external targets

Mirror the security fix in NavLink so all external links are protected.

   <Link
     className={clsx(
       "font-medium text-base transition-colors hover:text-foreground xl:text-sm",
       pathname.startsWith(props.href)
         ? "text-foreground"
         : "text-muted-foreground",
       props.icon ? "flex flex-row gap-3" : "",
     )}
     href={props.href}
     onClick={props.onClick}
-    target={props.href.startsWith("http") ? "_blank" : ""}
+    target={props.href.startsWith("http") ? "_blank" : undefined}
+    rel={props.href.startsWith("http") ? "noopener noreferrer" : undefined}
   >
apps/portal/src/app/ai/chat/streaming/page.mdx (1)

98-154: Unified event parsing is great – just one more refactor needed

Switching to a single parsedEventData and branching on parsedEventData.type greatly improves clarity and eliminates double parsing. The new monitor_transaction branch aligns perfectly with our execution docs.

Before approving, please remove the remaining hard-coded chain ID in the AI streaming example:

• In apps/portal/src/app/ai/chat/streaming/page.mdx at line 62:

   "data": {
-    "chainId": 11155111,
+    "chainId": parsedEventData.data.chainId, // or use a placeholder like {{chainId}}
     "to":   parsedEventData.data.to,
     "data": parsedEventData.data.data,
   }

Replace the literal 11155111 with the dynamic value from parsedEventData.data.chainId (or a template placeholder) so the example reflects the actual runtime chain.

♻️ Duplicate comments (4)
apps/portal/src/app/ai/chat/execution/page.mdx (3)

18-21: Use the exact Authorization: Bearer header, per policy

Change “a Authorization header” to “an Authorization: Bearer <YOUR_WALLET_JWT> header” and show the Bearer prefix explicitly. This aligns with our documented guidance to use Authorization: Bearer and never put tokens in URLs. (Using learnings: Authorization: Bearer header – never embed tokens in URLs.)

 -  - OR a `Authorization` header with a valid wallet JWT for user wallet authentication
+  - OR an `Authorization: Bearer <YOUR_WALLET_JWT>` header with a valid wallet JWT for user wallet authentication

28-53: Show auth headers in the interactive example

Demonstrate either server key or user JWT in the props so readers don’t miss the required headers.

-<OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={{
+<OpenApiEndpoint
+  path="/ai/chat"
+  method="POST"
+  components={{
+    request: {
+      headers: {
+        "x-secret-key": "<YOUR_SECRET_KEY>",
+        // OR use user-wallet auth:
+        // "Authorization": "Bearer <YOUR_WALLET_JWT>",
+      },
+    },
+  }}
+  requestBodyOverride={{
   "messages": [
     {
       "role": "user",
       "content": "Transfer 10 USDC to vitalik.eth"
     }
   ],
   "context": {
     "from": "0x...",
     "auto_execute_transaction": true,
     "chain_ids": [8453]
   }
-}} responseExampleOverride={{
+}} 
+  responseExampleOverride={{
   "message": "I've sent 10 USDC to Vitalik's wallet with transaction ID 11cd95e3-c0ee-4468-97c1-fd05dc919cdb. It should be confirmed in a few seconds.",
   "session_id": "123",
   "request_id": "456",
   "actions": [{
     "session_id": "8d1bfac4-e6c0-473b-bbb6-649f459d37e6",
     "request_id": "79066871-b86f-4814-8027-5f34d99df389",
     "source": "model",
     "type": "monitor_transaction",
     "data": {
         "transaction_id": "11cd95e3-c0ee-4468-97c1-fd05dc919cdb"
     }
 }]
-}} />
+}} 
+/>

57-57: Use the correct parameter name: auto_execute_transaction

Earlier you require context.auto_execute_transaction; keep the same name here to avoid confusion.

-When the `auto_execute` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a 'sign_transaction' action type.
+When the `auto_execute_transaction` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a 'sign_transaction' action type.
apps/portal/src/app/ai/chat/streaming/page.mdx (1)

86-90: Document both auth options (server OR user) in the TS example

Show Authorization: Bearer as an alternative to x-secret-key in headers. This keeps streaming docs consistent with execution docs.

 headers: {
   "Content-Type": "application/json",
-  "x-secret-key": "<your-secret-key>",
+  // Choose ONE of the following auth headers:
+  "x-secret-key": "<your-secret-key>",
+  // "Authorization": "Bearer <YOUR_WALLET_JWT>",
 },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 32584b3 and b1f20d0.

📒 Files selected for processing (11)
  • apps/playground-web/src/app/ai/api/chat.ts (2 hunks)
  • apps/playground-web/src/app/ai/api/types.ts (1 hunks)
  • apps/playground-web/src/app/ai/chat/page.tsx (1 hunks)
  • apps/playground-web/src/app/ai/components/ChatPageContent.tsx (4 hunks)
  • apps/playground-web/src/app/navLinks.ts (1 hunks)
  • apps/portal/src/app/Header.tsx (1 hunks)
  • apps/portal/src/app/ai/chat/execution/page.mdx (1 hunks)
  • apps/portal/src/app/ai/chat/page.mdx (1 hunks)
  • apps/portal/src/app/ai/chat/streaming/page.mdx (2 hunks)
  • apps/portal/src/app/ai/sidebar.tsx (2 hunks)
  • apps/portal/src/app/page.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • apps/portal/src/app/page.tsx
  • apps/portal/src/app/ai/sidebar.tsx
  • apps/playground-web/src/app/navLinks.ts
  • apps/playground-web/src/app/ai/chat/page.tsx
  • apps/playground-web/src/app/ai/api/chat.ts
  • apps/playground-web/src/app/ai/api/types.ts
  • apps/portal/src/app/ai/chat/page.mdx
  • apps/playground-web/src/app/ai/components/ChatPageContent.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/portal/src/app/Header.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/portal/src/app/Header.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Use `Authorization: Bearer` header – never embed tokens in URLs

Applied to files:

  • apps/portal/src/app/ai/chat/execution/page.mdx
🪛 LanguageTool
apps/portal/src/app/ai/chat/execution/page.mdx

[grammar] ~16-~16: There might be a mistake here.
Context: ...m - auto_execute_transaction set to true - (Optional) chain_ids set to the chain ...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... chain IDs to execute the transaction on - The API must be called with either: - ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...on - The API must be called with either: - your x-secret-key header for server wa...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ... header for server wallet authentication - OR a Authorization header with a valid...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...d95e3-c0ee-4468-97c1-fd05dc919cdb" } }] }} /> ## Prepare for Signing When t...

(QB_NEW_EN)


[grammar] ~52-~52: There might be a mistake here.
Context: ...e3-c0ee-4468-97c1-fd05dc919cdb" } }] }} /> ## Prepare for Signing When the ...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Size
🔇 Additional comments (2)
apps/portal/src/app/Header.tsx (1)

146-148: Rename to “Blockchain LLM” looks good

Label change in aiLinks aligns with PR intent and the rest of the docs. No functional concerns.

apps/portal/src/app/ai/chat/execution/page.mdx (1)

1-1: Import Verified: OpenApiEndpoint Is Correctly Exported from @doc

The search confirms that OpenApiEndpoint is re-exported in
apps/portal/src/components/Document/index.ts:6 via
export { OpenApiEndpoint } from "./APIEndpointMeta/OpenApiEndpoint";

Nearby MDX pages consistently import it from @doc, so the alias is correct and no changes are needed.

@joaquim-verges joaquim-verges force-pushed the _AI_Rename_Chat_API_to_Blockchain_LLM_and_add_transaction_execution_docs branch from b1f20d0 to 46ea117 Compare August 26, 2025 09:45
@vercel vercel bot temporarily deployed to Preview – nebula August 26, 2025 09:45 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui August 26, 2025 09:45 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www August 26, 2025 09:45 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
apps/portal/src/app/ai/chat/execution/page.mdx (3)

57-57: Use the correct parameter name: auto_execute_transaction (not auto_execute)

This mismatches the rest of the doc and the API surface; will confuse users.

Apply this diff:

-When the `auto_execute` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a 'sign_transaction' action type.
+When the `auto_execute_transaction` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a `sign_transaction` action type.

18-21: Fix auth header phrasing and include explicit Bearer scheme

The docs say “a Authorization header” and omit the Bearer scheme. This will lead to incorrect requests and confusion for wallet JWT usage.

Apply this diff:

-- The API must be called with either:
-  - your `x-secret-key` header for server wallet authentication
-  - OR a `Authorization` header with a valid wallet JWT for user wallet authentication
+- The API must be called with either:
+  - your `x-secret-key` header for server wallet authentication
+  - OR an `Authorization: Bearer <YOUR_WALLET_JWT>` header for user wallet authentication

14-21: Ensure consistency for auto_execute_transaction and include the Bearer scheme in the auth snippet

Please address the following in apps/portal/src/app/ai/chat/execution/page.mdx:

  • Line 57
    • Update the stale parameter name:
      - When the `auto_execute` parameter is set to `false` or omitted, …
      + When the `auto_execute_transaction` parameter is set to `false` or omitted, …
  • Lines 19–21
    • Require the Bearer prefix for the Authorization header:
      - The API must be called with either:
      -   your `x-secret-key` header for server wallet authentication
      -   OR a `Authorization` header with a valid wallet JWT for user wallet authentication
      + The API must be called with either:
      +   your `x-secret-key` header for server wallet authentication
      +   OR an `Authorization: Bearer <wallet_JWT>` header for user wallet authentication

(Optional) The scan also surfaced other docs and code locations where “Authorization” is mentioned without explicitly showing the “Bearer” prefix (e.g. in OpenApiEndpoint.tsx and various MDX pages). You may want to plan a follow-up PR to sweep those for consistency.

🧹 Nitpick comments (5)
apps/portal/src/app/ai/chat/page.mdx (2)

3-6: Rebrand copy reads well; consider a brief migration note

Heading and intro align with “Blockchain LLM.” Optionally add a one‑liner: “Formerly ‘Chat API’; no endpoint changes required,” to smooth migration for readers scanning for renamed concepts.


10-11: Micro copy polish for bullets

“swaps from/to any token pair” is slightly awkward. Recommend “between any token pair.”

Apply this diff:

-- Execute or prepare swaps from/to any token pair
+- Execute or prepare swaps between any token pair
apps/portal/src/app/ai/chat/execution/page.mdx (3)

5-9: Hyphenate “auto‑execute” for clarity and consistency

Minor readability improvement; the term appears as a compound adjective.

Apply this diff:

-thirdweb AI can either auto execute transactions or prepare them for signing.
+thirdweb AI can either auto-execute transactions or prepare them for signing.

28-53: Show headers in the example to disambiguate server vs user auth

Surface the required headers directly in the example so readers can copy-paste a working call.

Apply this diff:

-<OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={{
+<OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={{
   "messages": [
     {
       "role": "user",
       "content": "Transfer 10 USDC to vitalik.eth"
     }
   ],
   "context": {
     "from": "0x...",
     "auto_execute_transaction": true,
     "chain_ids": [8453]
   }
-}} responseExampleOverride={{
+}} components={{
+  request: {
+    headers: {
+      "x-secret-key": "<YOUR_SECRET_KEY>",
+      "Authorization": "Bearer <YOUR_WALLET_JWT>"
+    }
+  }
+}} responseExampleOverride={{
   "message": "I've sent 10 USDC to Vitalik's wallet with transaction ID 11cd95e3-c0ee-4468-97c1-fd05dc919cdb. It should be confirmed in a few seconds.",
   "session_id": "123",
   "request_id": "456",
   "actions": [{
     "session_id": "8d1bfac4-e6c0-473b-bbb6-649f459d37e6",
     "request_id": "79066871-b86f-4814-8027-5f34d99df389",
     "source": "model",
     "type": "monitor_transaction",
     "data": {
         "transaction_id": "11cd95e3-c0ee-4468-97c1-fd05dc919cdb"
     }
   }]
 }} />

If doesn’t support components.request.headers in your doc system, mirror the example with a fenced HTTP snippet showing both header options instead.


55-59: Optional: include a concrete example for “Prepare for Signing”

Consider mirroring the Auto Execute block with a requestBodyOverride (auto_execute_transaction: false) and a minimal responseExampleOverride that shows a sign_transaction action with required fields.

I can draft the exact example payloads if you share the latest action schema fields (e.g., to, data, value, chain_id, gas, nonce).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b1f20d0 and 46ea117.

📒 Files selected for processing (11)
  • apps/playground-web/src/app/ai/api/chat.ts (2 hunks)
  • apps/playground-web/src/app/ai/api/types.ts (1 hunks)
  • apps/playground-web/src/app/ai/chat/page.tsx (1 hunks)
  • apps/playground-web/src/app/ai/components/ChatPageContent.tsx (4 hunks)
  • apps/playground-web/src/app/navLinks.ts (1 hunks)
  • apps/portal/src/app/Header.tsx (1 hunks)
  • apps/portal/src/app/ai/chat/execution/page.mdx (1 hunks)
  • apps/portal/src/app/ai/chat/page.mdx (1 hunks)
  • apps/portal/src/app/ai/chat/streaming/page.mdx (2 hunks)
  • apps/portal/src/app/ai/sidebar.tsx (2 hunks)
  • apps/portal/src/app/page.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • apps/portal/src/app/page.tsx
  • apps/playground-web/src/app/ai/chat/page.tsx
  • apps/playground-web/src/app/ai/api/types.ts
  • apps/portal/src/app/Header.tsx
  • apps/playground-web/src/app/navLinks.ts
  • apps/playground-web/src/app/ai/api/chat.ts
  • apps/playground-web/src/app/ai/components/ChatPageContent.tsx
  • apps/portal/src/app/ai/chat/streaming/page.mdx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/portal/src/app/ai/sidebar.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/portal/src/app/ai/sidebar.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Use `Authorization: Bearer` header – never embed tokens in URLs

Applied to files:

  • apps/portal/src/app/ai/chat/execution/page.mdx
🪛 LanguageTool
apps/portal/src/app/ai/chat/execution/page.mdx

[grammar] ~16-~16: There might be a mistake here.
Context: ...m - auto_execute_transaction set to true - (Optional) chain_ids set to the chain ...

(QB_NEW_EN)


[grammar] ~17-~17: There might be a mistake here.
Context: ... chain IDs to execute the transaction on - The API must be called with either: - ...

(QB_NEW_EN)


[grammar] ~18-~18: There might be a mistake here.
Context: ...on - The API must be called with either: - your x-secret-key header for server wa...

(QB_NEW_EN)


[grammar] ~19-~19: There might be a mistake here.
Context: ... header for server wallet authentication - OR a Authorization header with a valid...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...d95e3-c0ee-4468-97c1-fd05dc919cdb" } }] }} /> ## Prepare for Signing When t...

(QB_NEW_EN)


[grammar] ~52-~52: There might be a mistake here.
Context: ...e3-c0ee-4468-97c1-fd05dc919cdb" } }] }} /> ## Prepare for Signing When the ...

(QB_NEW_EN)

apps/portal/src/app/ai/chat/page.mdx

[grammar] ~7-~7: There might be a mistake here.
Context: ...Query real-time data from the blockchain - Analyze transactions - Fetch token balances, pr...

(QB_NEW_EN)


[grammar] ~11-~11: There might be a mistake here.
Context: ... or prepare swaps from/to any token pair - Deploy contracts - Generate images - Search th...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/portal/src/app/ai/sidebar.tsx (1)

7-7: Rename to “Blockchain LLM” looks correct and consistent with PR scope

Good alignment with the rebrand in navigation. No issues spotted here.

Comment on lines +20 to +23
{
name: "Transaction Execution",
href: "/ai/chat/execution",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

New “Transaction Execution” doc link — verify route exists and is indexed

The link points to /ai/chat/execution. It looks like the MDX page was added in this PR; please also ensure it’s discoverable (sitemap/search index) and that the frontmatter includes title/description so it renders well in listings.

Run this quick check from repo root:


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# 1) Route file presence
test -f apps/portal/src/app/ai/chat/execution/page.mdx && echo "OK: execution page exists"

# 2) Basic frontmatter or H1
rg -n --hidden -C2 -S $'^---\\n|^title:\\s*|^#\\s*' apps/portal/src/app/ai/chat/execution/page.mdx || {
  echo "WARN: frontmatter/H1 not found (ensure title/description or a top-level heading exist)"; exit 1;
}

# 3) Optional: Confirm any sitemap or sidebar ordering includes the new path (heuristic)
rg -nS "/ai/chat/execution" apps/portal || echo "NOTE: /ai/chat/execution not referenced outside sidebar"

Length of output: 618


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "----- Head of page.mdx -----"
head -n20 apps/portal/src/app/ai/chat/execution/page.mdx

echo "----- Frontmatter start lines -----"
grep -n -E '^---' apps/portal/src/app/ai/chat/execution/page.mdx || true

echo "----- Title lines -----"
grep -n -E '^\s*title:' apps/portal/src/app/ai/chat/execution/page.mdx || true

echo "----- Description lines -----"
grep -n -E '^\s*description:' apps/portal/src/app/ai/chat/execution/page.mdx || true

echo "----- H1 lines -----"
grep -n -E '^# ' apps/portal/src/app/ai/chat/execution/page.mdx || true

echo "----- References to /ai/chat/execution in apps/portal -----"
rg -n "/ai/chat/execution" apps/portal || true

Length of output: 1805


Add frontmatter and ensure indexing for “Transaction Execution” page

The new MDX page exists and includes a top-level heading, but it currently lacks frontmatter metadata and isn’t referenced in any sitemap or search‐index configuration. To ensure this doc is discoverable and renders properly in listings:

• apps/portal/src/app/ai/chat/execution/page.mdx
– Add frontmatter at the very top, for example:
diff +--- +title: "Transaction Execution" +description: "Use thirdweb AI to auto-execute or prepare transactions for signing." +---
– This will provide explicit title/description for sitemap generators and search indexers.
– Retain or move the existing # Transaction Execution H1 below the frontmatter.

• Sitemap/search index configuration
– Verify that /ai/chat/execution is included in your sitemap (e.g., via next-sitemap or other routing exports).
– Ensure your search indexing process (DocSearch, Lunr, etc.) picks up MDX files under apps/portal/src/app/ai/chat.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
name: "Transaction Execution",
href: "/ai/chat/execution",
},
file=apps/portal/src/app/ai/chat/execution/page.mdx
---
title: "Transaction Execution"
description: "Use thirdweb AI to auto-execute or prepare transactions for signing."
---
# Transaction Execution
<!-- rest of the MDX content follows -->

@joaquim-verges joaquim-verges merged commit 34239ea into main Aug 26, 2025
25 checks passed
@joaquim-verges joaquim-verges deleted the _AI_Rename_Chat_API_to_Blockchain_LLM_and_add_transaction_execution_docs branch August 26, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Playground Changes involving the Playground codebase. Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants