Files
botsmann/next.config.js
CatoandClaude Opus 5.5 9dde8fbee9 feat(forms): prose fields on chatkit DictationField, with a working microphone (#330)
* wip: prose fields on chatkit DictationField (awaits chatkit 0.45)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuMRAXYWNkfowAXVfi

* feat(forms): prose fields on chatkit DictationField, with a working microphone

- Bump @bitbaum/chatkit to ^0.45.0.
- One app wrapper, components/forms/TextBox, around DictationField. Used by
  the bot builder (name, description, knowledge topic and content, system
  prompt), the custom-bot edit page (name, description, system prompt,
  greeting), the contact message, the demo intake questions, quick-create
  (name, relationship, memories) and the consultation form's
  react-hook-form message field ({...register('message')}).
- app/api/transcribe: dictation server leg on ai-kit's speechChain and
  transcribe(), rate limited, recordings and transcripts neither stored nor
  logged. Every field and every in-page chat points voice at it, so the
  microphone works where the browser has no recogniser of its own.
- Permissions-Policy allowed no microphone at all (microphone=()), which
  blocked every mic on the site; it now allows the site itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuMRAXYWNkfowAXVfi

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-19 14:23:42 +01:00

124 lines
4.0 KiB
JavaScript

/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
images: {
// The remotePatterns entry that lived here allowed post images to be
// loaded from the retired botsmann-blog-content GitHub repo. Post images
// are committed under public/blog/ now, so nothing remote is left to allow.
unoptimized: true,
},
serverExternalPackages: ['onnxruntime-node', '@xenova/transformers', 'sharp'],
// typedRoutes graduated from `experimental` to a stable top-level option in Next 16.
typedRoutes: true,
env: {
NEXT_PUBLIC_DEPLOY_TIME: new Date().toUTCString(),
},
// Redirects for URL structure migration
async redirects() {
return [
// Documents -> My Data
{
source: '/documents',
destination: '/my-data',
permanent: true,
},
// Create -> Personal
{
source: '/create',
destination: '/personal',
permanent: true,
},
// Solutions -> Enterprise (consolidation)
{
source: '/solutions/businesses',
destination: '/enterprise',
permanent: true,
},
{
source: '/solutions/governments',
destination: '/enterprise',
permanent: true,
},
];
},
headers: async () => {
const securityHeaders = [
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(self), geolocation=()',
},
{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://giscus.app https://platform.twitter.com https://loki.orangecat.ch",
"style-src 'self' 'unsafe-inline'",
"img-src 'self' data: blob: https://images.unsplash.com",
"font-src 'self'",
// api.github.com / raw.githubusercontent.com were here so the blog and
// Knowledge Center could fetch their markdown from two separate
// GitHub repos at request time. That content is committed under
// content/ now and read from disk at build time — nothing in the app
// talks to GitHub any more.
"connect-src 'self' https://api.groq.com https://openrouter.ai https://api.openai.com https://*.supabase.co https://supabase.orangecat.ch https://loki.orangecat.ch",
// bip-kit renders video embeds through the privacy players only
// (youtube-nocookie / player.vimeo.com) and allowlists the source
// hosts at parse time — a markdown file cannot inject another iframe.
"frame-src 'self' https://www.youtube-nocookie.com https://player.vimeo.com https://giscus.app",
"frame-ancestors 'none'",
].join('; '),
},
];
return [
{
source: '/api/:path*',
headers: [{ key: 'Cache-Control', value: 'no-store, max-age=0' }],
},
{
source: '/(.*)',
headers: securityHeaders,
},
{
// The account pages answer per person (the session decides whether
// /account shows your account or sends you to sign in), so no
// browser or proxy may keep a copy: a cached /account was served to
// the same browser after sign-out.
source: '/((?!api|account|auth).*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=3600, s-maxage=86400, stale-while-revalidate=60',
},
],
},
{
source: '/:path(account|auth)/:rest*',
headers: [{ key: 'Cache-Control', value: 'private, no-store' }],
},
{
source: '/account',
headers: [{ key: 'Cache-Control', value: 'private, no-store' }],
},
];
},
};
module.exports = nextConfig;