@coral-ai/chat 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -10
- package/dist/index.d.ts +496 -87
- package/dist/index.js +1704 -462
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @coral-ai/chat
|
|
2
2
|
|
|
3
|
-
Chat surface for Coral: `<Chat>`, `<Chat.Canvas>`, `<Chat.Messages>`, `<Chat.Input>`,
|
|
3
|
+
Chat surface for Coral: `<Chat>`, `<Chat.Canvas>`, `<Chat.Messages>`, `<Chat.Input>`, streaming helpers, and a model-agnostic agent tool-use runner.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -13,16 +13,13 @@ Peer dependencies do not install transitively. Install all of the above explicit
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import { Chat
|
|
16
|
+
import { Chat } from "@coral-ai/chat";
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
return { content: `You said: ${message}` };
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
<Chat
|
|
23
|
-
agents={{ default: { handler: myHandler } }}
|
|
24
|
-
agent="default"
|
|
25
|
-
/>
|
|
18
|
+
<Chat onSendMessage={async (input) => `You said: ${input}`} />
|
|
26
19
|
```
|
|
27
20
|
|
|
21
|
+
`onSendMessage` is the one handler — return a string, an async iterable of
|
|
22
|
+
`ChatChunk`s, or a `ChatResponse`. A backend URL can also be supplied via the
|
|
23
|
+
`api` prop or `coral.config.json`'s `chat.api`.
|
|
24
|
+
|
|
28
25
|
See [coral-ai](https://github.com/mochimilk/coral-ai) for the full project.
|