Skip to content

feat: AI chat module, first release - #1

Merged
sauce-base merged 34 commits into
mainfrom
dev
Nov 30, 2026
Merged

sauce-base merged 34 commits into
mainfrom
dev

Conversation

@roble

@roble roble commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Release from dev. Expected: v0.1.0 (first release, from 0.0.0). Merge with a merge commit.

Needs core v3.3.0 (released): AppLayout's resizable and collapseSidebar, SidebarResizer's contained, and Navigation's active.

What it is

A chat page on laravel/ai, built on shadcn-vue AI Elements:

  • streamed replies with steps (thinking, tool calls), markdown, web search, image generation, an account tool;
  • conversations titled at milestones, renamed, pinned, deleted, searched, paged;
  • monthly message and image limits from billing plans, with a usage bar above the box;
  • WebMCP tools for the visitor's browser agent;
  • admin settings for provider keys, models and images, plus a conversation viewer;
  • a test mode with canned demos, so nothing reaches a paid API.

The chat list lives in its own resizable panel next to a collapsed app sidebar (ai-chat.sessions = page, the default), or in the app sidebar (sidebar, set by the chat template).

Checks

PHPUnit (119, with the chat template) and Pint pass. Browser QA of scroll, thinking, panel and search on the chat template.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an authenticated AI chat experience with streaming replies, conversation history, search, and controls to pin, rename, and delete chats.
    • Added model selection, monthly usage indicators, account information, web search, and image generation.
    • Added code and image previews, Markdown formatting, source links, and optional voice dictation.
    • Added admin settings for providers and models, plus a read-only conversation viewer.
    • Added configurable chat placement in the page or sidebar, and browser agent access where supported.
    • Added a test mode with sample conversations and demo replies.
  • Documentation
    • Expanded setup and usage guidance for AI Chat.

roble and others added 30 commits November 25, 2026 10:40
Ported from the whatsthere chat module without the map: ownership-scoped
conversations, Vercel protocol streaming, provider errors kept in the stream
and stripped of provider wording, and AI_CHAT_TEST_MODE canned replies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vue page on @ai-sdk/vue: new chats move onto their own URL from the
X-Conversation-Id header, an expired session is reported instead of an
empty reply, reasoning and tool calls fold into a steps list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
about_my_account reads the signed-in user's profile, plus plan and limits
when billing is installed and workspace when tenancy is; it takes the user
from the agent, never an id from the model. generate_image stores to the
public disk and renders inline. Canned scenarios cover both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ai_chat_messages and ai_chat_images are offered in the product form.
Counted from stored messages and the month's image folder, no counter.
A key no plan declares is unlimited, so installing the module never
switches the chat off. Over the limit the stream answers 429 and the
page says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AiChatSettings holds extra instructions, the models users may pick and
the default; the stream route accepts only an offered model. A
read-only Chats resource shows each conversation's transcript. Both
need the 'manage ai chat' permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ask_this_assistant, read_current_chat, list_chat_sessions and
open_chat_session, registered while the chat page is open. Helpers move
to resources/js/lib so vitest covers them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e tail

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 0.x-dev alias makes Composer guess ^0.0.0@dev on require, which no
version matches, so installing the module into a new app failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Canned replies lacked X-Accel-Buffering, so nginx (Herd) delivered them
in one piece; the reply then finished before the move onto /chat/{id},
and the session reload cancelled that visit. The reload now waits for
the move, which refreshes the list itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every canned reply reused the conversation id as its messageId, so the
SDK merged the second reply into the first and the first vanished.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test mode stored nothing, so every chat reopened empty while there is
no provider; it now stores both turns as laravel/ai would. show() reads
the stored rows and restores generate_image results as image parts,
which the text-only replay dropped for real replies too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New chat and the user's chats register at core's dashboard::sidebar.content,
between the nav and the bottom links, on every signed-in page, instead of
a second column on the chat page. Collapsed, a history button reopens the
sidebar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
laravel/ai sends images to Gemini by default; AI_CHAT_IMAGE_PROVIDER,
AI_CHAT_IMAGE_MODEL and AI_CHAT_IMAGE_QUALITY choose instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK edits a message's parts array in place, so ChatSteps, given that
array, never re-rendered after the first part; test mode only looked
right because reasoning came first. ChatMessage now computes the steps
(lib stepsIn, unit-tested on the real stream's part shape).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- API keys per provider, encrypted, write-only in the form (blank keeps
  the saved key), applied to laravel/ai's config when it is first used;
  a saved key wins over .env.
- The picker offers only models whose provider has a key.
- The seeder offers OpenAI, Anthropic and Gemini's cheapest, default and
  smartest models from laravel/ai, defaulting to the cheapest, and never
  touches an admin's own list.
- Image provider, model and quality as settings, .env as fallback.
- Fix: clearing the instructions no longer fails the save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
API keys are rows of provider and key: a saved key loads as its
provider with the key left blank (kept on save), a removed row deletes
the key, a provider takes one key. Models are an inline table whose
provider is a select of laravel/ai's configured providers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One collapsible group per provider: its select, its write-only key
(the placeholder says when the server environment provides one), a
"Remove saved key" box, and its models as an inline table. The default
model select is grouped the same way. Settings keep the flat shape;
the page converts on fill and save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The picker preselected the admin's default even when its provider had
no key, and the server refused every message sent with it. The default
now falls back to the first offered model, for the page and the stream.
The admin field explains what the default model is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on phones

The provider selects listed every config/ai.php entry, including
embedding, reranking and audio providers that can't chat or draw.
Providers asks laravel/ai which ones it can build a text or image
client for, and names them as they write themselves (OpenAI-compatible,
xAI, DeepSeek). On phones the model picker no longer takes half the
input row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… WebMCP

- Page rebuilt on shadcn-vue AI Elements: message scroller, markdown with
  code blocks, sources, images, an artifact panel, steps, and a message box
  with model picker and voice input.
- Test mode plays demos (resources/demos/*.json) through a demo provider
  instead of canned replies: the real agent, tools, storage and stream run.
- Sessions: date groups, rename (renamed_at keeps a chosen title) and delete.
- Retry replaces the last turn instead of adding one, and a failed retry
  keeps the old answer. A stopped reply is still stored; streams get 300 s.
- Back and forward reload the chat's messages; a refused message goes back
  into the box with the server's reason.
- WebMCP: the page's tools are listed in a sidebar panel, with setup steps
  in browsers without WebMCP.
- The mic and Stop buttons are type="button": as submit buttons in the
  form, the mic sent the text or stopped as soon as it started.
- Focus, Escape to stop, a screen reader announcement per reply, example
  prompts, and copy and retry on touch screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Pin or unpin a chat from its … menu (tooltip "More"); pinned chats lead the list.
- The sidebar lists every pinned chat and the newest 50 others; Show more adds 50,
  kept for the login session.
- A chat opens on its newest 50 messages; older pages load as you scroll up.
- The month's usage shows above the box (ChatInputBar in ChatInput's `top` slot):
  muted and dismissible from 80%, orange with Upgrade at the limit. Counted
  optimistically as a message is sent.
- Code blocks no longer pass the markdown renderer's props onto the DOM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The waiting line is the reasoning line itself (an empty reply renders it), so
the thought takes over in place. Steps follow shadcn-vue's Reasoning: open while
a thought streams, closed once done, a click overrides. While a reply arrives,
its messages lay out at full size from the first frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A loaded transcript's questions count as handled (patched message-scroller):
  the first swap that kept the child count scrolled to the chat's first question.
- No anchors or auto-scroll: a new question takes the view to the end once, the
  reply never drags it, and a button over the end shows dots while a reply
  streams below, an arrow after. A fixed 12rem gap replaces the screen-tall
  spacer that, shrinking, pulled the view.
- New messages lay out at full size before joining content-visibility, so the
  scroller never places them by the 10rem estimate.
- Older pages: measure the marker after the scroller restores the position.
- Thoughts stay closed, render markdown, muted. New `thinking` demo.
- The chat page's sidebar is resizable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ai-chat.sessions`: `page` (default) gives the app sidebar a "Chat" item, which
collapses to its icons on the chat, and the chat a resizable panel with New
chat, search, the list and WebMCP (a sheet on phones). `sidebar` keeps the list
in the app sidebar on every page, for a chat-first app. The shared list is only
built where it shows.

Search: GET chat/sessions/search, the user's chats by title; results follow a
rename, pin or delete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roble and others added 2 commits November 29, 2026 21:09
The chat page uses AppLayout's `resizable` and `collapseSidebar`, the nav item's
`active` attribute and SidebarResizer inside a panel, all from core 3.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ydration

ChatPanel uses core 3.3's SidebarResizer `contained` instead of overriding its
position. The panel width and the dismissed usage bar are read once mounted, so
a server-rendered page hydrates with what it was rendered with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 25824025-565f-4876-b214-1a9cd11a9825
Commits

Reviewing files that changed from the base of the PR and between 19224c8 and 7a27ca9.

Files selected for processing: 2

  • resources/boost/skills/saucebase-ai-chat-development/SKILL.md
  • tests/e2e/tests/chat.spec.ts

saucebase-dev is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.

  • Ask an admin to upgrade

Open in CodeRabbit

Walkthrough

This change adds an authenticated AI chat module with streamed replies, persisted conversations, provider and demo modes, account and image tools, session controls, monthly usage handling, and Filament administration. It replaces the placeholder page with a Vue chat interface and adds supporting UI components, tests, and documentation.

Changes: AI Chat module

Layer / File(s) Summary
Configuration and conversation storage
config/*, database/migrations/*, database/settings/*, database/seeders/*, routes/capabilities.php, composer.json, package.json, README.md
Adds chat, session, test-mode, and image settings; conversation tables and settings defaults; model seeding; billing capability declarations; package requirement updates; and setup instructions.
Providers, tools, and usage
src/Ai/*, src/Ai/Demo/*, src/Ai/Tools/*, src/Settings/*, src/Usage.php, src/Providers/ApplyProviderKeys.php, resources/demos/*, tests/Feature/{DemoProvider,ProviderCatalog,Providers,Tools,UsageLimits}Test.php
Adds provider catalogs, agents, account and image tools, demo-provider behavior, and monthly usage calculations. Demo fixtures and feature tests cover provider, tool, and usage behavior.
Conversation routes and lifecycle
routes/{web,navigation}.php, src/Http/Controllers/AiChatController.php, src/Sessions.php, src/Jobs/GenerateConversationTitle.php, src/Providers/AiChatServiceProvider.php, database/migrations/*, tests/Feature/{ChatStream,ConversationTitle,History,Placement,Sessions,StreamFailure}Test.php
Adds authenticated chat routes, streaming and history endpoints, ownership-scoped conversation operations, session search and pagination, title generation, and stream error handling.
Browser helpers and WebMCP tools
resources/js/lib/*, resources/js/composables/*, resources/js/vue/composables/useDictation.ts
Adds client-side parsing for reply parts, session grouping, usage state, dictation, CSRF-token access, and WebMCP tool actions and registration, with Vitest coverage.
Chat rendering components
resources/js/vue/components/Chat{Artifact,CodeBlock,Image,Markdown,Message,Sources,Steps}.vue, resources/js/vue/components/ui/{bubble,button,code-block,hover-card,message,spinner,trace}/*
Adds chat message rendering and reusable components for Markdown, highlighted code, artifacts, sources, reasoning traces, bubbles, and messages.
Composer, sessions, and scrolling
resources/js/vue/components/Chat{Input,InputBar,Panel,ScrollButton,Sessions,UsageBar}.vue, resources/js/vue/components/WebMcpMenuItem.vue, resources/js/vue/components/ui/message-scroller/*
Adds composer and session-list interactions, usage and WebMCP controls, and message scrolling with viewport, anchor, and visibility handling.
Filament settings and conversation viewer
src/Filament/*, tests/Feature/AdminTest.php
Registers an AI Chat settings page and a read-only conversation resource. Tests cover settings, access permissions, and conversation viewing.
Chat page and module guidance
resources/js/vue/app.ts, resources/js/vue/pages/Index.vue, resources/boost/*, resources/js/react/*, tests/Feature/IndexTest.php, tests/e2e/index.spec.ts, .github/workflows/test.yml
Replaces the placeholder page with the chat interface, registers conditional sidebar components, updates development guidance and workflow dependencies, and removes the old React placeholder and its index tests.

Estimated code review effort: 5 (Critical) | ~90 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant AiChatController
  participant ChatAgent
  participant Conversation
  Browser->>AiChatController: Submit authenticated chat message
  AiChatController->>ChatAgent: Validate model and stream reply
  ChatAgent->>Conversation: Continue conversation and store turn
  AiChatController-->>Browser: Stream reply frames and conversation ID
Loading
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Free
  • Run ID: fab3b41c-22e6-4b2d-ae9e-54d1bbc6b37c
Commits

Reviewing files that changed from the base of the PR and between b32a540 and 19224c8.

Files selected for processing: 1

  • .github/workflows/test.yml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

roble and others added 2 commits November 30, 2026 10:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sauce-base
sauce-base merged commit 018d7c8 into main Nov 30, 2026
5 checks passed
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.

2 participants