Use as-is. Replace Inputs. Keep identifiers, paths, and events unchanged.
Brand Name: "<YOUR BRAND NAME>"
Aesthetic Theme: "<YOUR AESTHETIC THEME>"
Reference Sites:| // src/routes/index.tsx | |
| import { createFileRoute } from '@tanstack/react-router' | |
| import { Chat } from '../components/Chat' | |
| export const Route = createFileRoute('/')({ component: App }) | |
| function App() { | |
| return ( | |
| <div className="min-h-screen bg-gradient-to-b from-slate-900 via-slate-800 to-slate-900 text-white"> | |
| <Chat /> | |
| </div> |
| // components/Chat.tsx | |
| import { useState } from "react"; | |
| import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; | |
| export function Chat() { | |
| const [input, setInput] = useState(""); | |
| const { messages, sendMessage, isLoading } = useChat({ | |
| connection: fetchServerSentEvents("/api/chat"), | |
| }); |
| // src/routes/api/chat.ts | |
| // We'll need to import createFileRoute from Tanstack Router | |
| import { createFileRoute } from "@tanstack/react-router" | |
| import { chat, toStreamResponse } from "@tanstack/ai"; | |
| import { openai } from "@tanstack/ai-openai"; | |
| // Then we'll wrap the POST request in the expected shell using createFileRoute | |
| export const Route = createFileRoute("/api/chat")({ | |
| server: { |
| netlify deploy --create-site <your-site-name> --prod |
| gh repo create -s=. --public --push |
| git add -A && git commit -m "initial commit of our demo" |
| npm install @tanstack/ai @tanstack/ai-react @tanstack/ai-openai |
| npm create @tanstack/start@latest |
| /* eslint-disable object-curly-spacing */ | |
| import { Command, flags } from '@oclif/command' | |
| const { prompt } = require("enquirer") | |
| const copy = require("copy-template-dir") | |
| const path = require("path") | |
| const fs = require("fs") | |
| const util = require("util") | |
| class Mycli extends Command { |