@assistant-ui/react-hook-form 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # @assistant-ui/react-hook-form
2
+
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6e9528d: build: add changesets
8
+ - 6e9528d: feat: add useAssistantTool API
9
+ - Updated dependencies [6e9528d]
10
+ - Updated dependencies [6e9528d]
11
+ - @assistant-ui/react@0.1.3
package/README.md CHANGED
@@ -1,39 +1,5 @@
1
- # `assistant-ui`
1
+ # `@assistant-ui/react-hook-form`
2
2
 
3
- `assistant-ui` is a set of React components for AI chat.
3
+ React Hook Form integration for `@assistant-ui/react`.
4
4
 
5
- - [Discord](https://discord.gg/S9dwgCNEFs)
6
- - [Website](https://assistant-ui.com/)
7
- - [Demo](https://assistant-ui-rsc-example.vercel.app/)
8
-
9
- ## Documentation
10
-
11
- - [Documentation](https://www.assistant-ui.com/docs/getting-started)
12
-
13
- ## Minimal Example with Vercel AI SDK
14
-
15
- ```sh
16
- npx assistant-ui@latest add modal
17
- ```
18
-
19
- ```tsx
20
- "use client";
21
-
22
- import { useChat } from "@ai-sdk/react";
23
- import { AssistantRuntimeProvider } from "@assistant-ui/react";
24
- import { useVercelUseChatRuntime } from "@assistant-ui/react-ai-sdk";
25
- import { AssistantModal } from "@/components/ui/assistant-ui/assistant-modal";
26
-
27
- export default const MyApp = () => {
28
- const chat = useChat({
29
- api: "/api/chat" // your backend route
30
- });
31
- const runtime = useVercelUseChatRuntime(chat);
32
-
33
- return (
34
- <AssistantRuntimeProvider runtime={runtime}>
35
- <AssistantModal />
36
- </AssistantRuntimeProvider>
37
- );
38
- }
39
- ```
5
+ Simply replace `useForm` with `useAssistantForm` to give the chatbot the ability to interact with your form.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@assistant-ui/react-hook-form",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "peerDependencies": {
7
- "@assistant-ui/react": "^0.1",
7
+ "@assistant-ui/react": "^0.1.3",
8
8
  "react-hook-form": "^7.x.x",
9
9
  "@types/react": "*",
10
10
  "react": "^18"
@@ -18,13 +18,23 @@
18
18
  "zod": "^3.23.8"
19
19
  },
20
20
  "devDependencies": {
21
- "@assistant-ui/react": "0.1.1",
21
+ "tsup": "^8.1.0",
22
+ "@assistant-ui/react": "0.1.3",
22
23
  "@assistant-ui/tsconfig": "0.0.0"
23
24
  },
24
25
  "publishConfig": {
25
- "access": "public"
26
+ "access": "public",
27
+ "provenance": true
28
+ },
29
+ "homepage": "https://assistant-ui.com/",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/Yonom/assistant-ui.git"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/Yonom/assistant-ui/issues"
26
36
  },
27
37
  "scripts": {
28
- "prepublish": "cp ../../README.md ./README.md"
38
+ "build": "tsup src/index.ts --format cjs,esm --dts --sourcemap"
29
39
  }
30
40
  }
@@ -33,7 +33,7 @@ export const useAssistantForm = <
33
33
  tools: {
34
34
  set_form_field: {
35
35
  ...formTools.set_form_field,
36
- execute: (args) => {
36
+ execute: async (args) => {
37
37
  // biome-ignore lint/suspicious/noExplicitAny: TODO
38
38
  form.setValue(args.name as any, args.value as any);
39
39
 
@@ -42,7 +42,7 @@ export const useAssistantForm = <
42
42
  },
43
43
  submit_form: {
44
44
  ...formTools.submit_form,
45
- execute: () => {
45
+ execute: async () => {
46
46
  const { _names, _fields } = form.control;
47
47
  for (const name of _names.mount) {
48
48
  const field = _fields[name];