MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / ChatSimple

Function ChatSimple

examples/remix/app/components/chat-simple.tsx:4–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { usePipe } from '@baseai/core/react';
3
4const ChatSimple = () => {
5 const { messages, input, handleInputChange, handleSubmit, isLoading, error } =
6 usePipe({
7 apiRoute: '/api/langbase/pipes/run-stream',
8 });
9
10 return (
11 <div className="flex flex-col w-full max-w-md py-24 mx-auto stretch">
12 {messages.map((m, i) => (
13 <div key={i} className="whitespace-pre-wrap">
14 {m.role === 'user' ? 'User: ' : 'AI: '}
15 {m.content}
16 </div>
17 ))}
18 <form onSubmit={handleSubmit} className="bg-black flex w-full">
19 <Input
20 className="fixed bottom-0 w-full max-w-md p-2 mb-8 border border-gray-300 rounded shadow-xl "
21 value={input}
22 placeholder="Say something..."
23 onChange={handleInputChange}
24 autoFocus
25 />
26 </form>
27 {isLoading && <div>AI is thinking...</div>}
28 {error && (
29 <div className="text-red-500">Error: {error.message}</div>
30 )}
31 </div>
32 );
33};
34
35export default ChatSimple;

Callers

nothing calls this directly

Calls 1

usePipeFunction · 0.90

Tested by

no test coverage detected