asasvirtuais 0.8.2 → 1.0.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/package.json +6 -59
- package/packages/action.tsx +1 -1
- package/packages/fields.tsx +6 -119
- package/packages/form.tsx +1 -16
- package/README.md +0 -474
- package/packages/airtable/index.ts +0 -189
- package/packages/airtable/types.ts +0 -722
- package/packages/auth0.ts +0 -43
- package/packages/blob.ts +0 -97
- package/packages/character/components/dialog.tsx +0 -36
- package/packages/character/components/form.tsx +0 -115
- package/packages/character/components/list.tsx +0 -171
- package/packages/chat/components/dialog.tsx +0 -45
- package/packages/chat/components/header/delete-dialog.tsx +0 -47
- package/packages/chat/components/header/menu.tsx +0 -56
- package/packages/chat/components/header/title.tsx +0 -33
- package/packages/chat/components/header/wrapper.tsx +0 -12
- package/packages/chat/components/input/index.tsx +0 -52
- package/packages/chat/components/input/menu.tsx +0 -34
- package/packages/chat/components/input/send.tsx +0 -20
- package/packages/chat/components/input/textarea.tsx +0 -22
- package/packages/chat/components/input/wrapper.tsx +0 -11
- package/packages/chat/components/messages/index.tsx +0 -4
- package/packages/chat/components/messages/wrapper.tsx +0 -21
- package/packages/chat/components/settings/model-selector.tsx +0 -83
- package/packages/chat/components/settings/temperature-slider.tsx +0 -67
- package/packages/dexie.ts +0 -126
- package/packages/env.ts +0 -8
- package/packages/fetch-interface.ts +0 -75
- package/packages/firebase.ts +0 -13
- package/packages/firestore.ts +0 -51
- package/packages/hooks.tsx +0 -123
- package/packages/interface.ts +0 -79
- package/packages/message/components/edit.tsx +0 -48
- package/packages/message/components/menu.tsx +0 -52
- package/packages/message/components/message.tsx +0 -41
- package/packages/message/components/tool-results.tsx +0 -36
- package/packages/next-interface.ts +0 -121
- package/packages/next.ts +0 -64
- package/packages/novelai.ts +0 -101
- package/packages/openrouter.ts +0 -4
- package/packages/react-interface.tsx +0 -383
- package/packages/wretch.ts +0 -22
- package/packages/yaml.ts +0 -163
- package/tsconfig.json +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asasvirtuais",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.1",
|
|
4
5
|
"directories": {
|
|
5
6
|
"packages": "./packages"
|
|
6
7
|
},
|
|
@@ -9,66 +10,12 @@
|
|
|
9
10
|
"tsconfig.json"
|
|
10
11
|
],
|
|
11
12
|
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./packages/index.ts",
|
|
14
|
-
"require": "./packages/index.ts",
|
|
15
|
-
"types": "./packages/index.ts"
|
|
16
|
-
},
|
|
17
13
|
"./package.json": "./package.json",
|
|
18
|
-
"./
|
|
19
|
-
"./
|
|
20
|
-
"./
|
|
21
|
-
"./*": ["./packages/*.ts", "./packages/*/index.ts", "./packages/*.tsx", "./packages/*/index.tsx"]
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"dev": "next dev",
|
|
25
|
-
"build": "next build",
|
|
26
|
-
"start": "next start",
|
|
27
|
-
"lint": "next lint",
|
|
28
|
-
"claude": "claude --dangerously-skip-permissions --mcp-config ./mcp.json",
|
|
29
|
-
"gemini": "gemini --yolo --all-files",
|
|
30
|
-
"env:pull": "vercel env pull .env"
|
|
31
|
-
},
|
|
32
|
-
"peerDependencies": {
|
|
33
|
-
"zod": "^4.1.11",
|
|
34
|
-
"next": "15.6.0-canary.34",
|
|
35
|
-
"wretch": "^2.11.0"
|
|
14
|
+
"./action": "./packages/action.tsx",
|
|
15
|
+
"./fields": "./packages/fields.tsx",
|
|
16
|
+
"./form": "./packages/form.tsx"
|
|
36
17
|
},
|
|
37
18
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"@auth0/nextjs-auth0": "^4.10.0",
|
|
40
|
-
"@chakra-ui/react": "^3.27.0",
|
|
41
|
-
"@emotion/react": "^11.14.0",
|
|
42
|
-
"@google-cloud/storage": "^7.17.1",
|
|
43
|
-
"@openrouter/ai-sdk-provider": "^1.2.0",
|
|
44
|
-
"ai": "^5.0.60",
|
|
45
|
-
"asasvirtuais": "^0.4.4",
|
|
46
|
-
"date-fns": "^4.1.0",
|
|
47
|
-
"dexie": "^4.2.0",
|
|
48
|
-
"firebase": "^12.3.0",
|
|
49
|
-
"firebase-admin": "^13.5.0",
|
|
50
|
-
"google-auth-library": "^10.4.0",
|
|
51
|
-
"googleapis": "^161.0.0",
|
|
52
|
-
"jszip": "^3.10.1",
|
|
53
|
-
"knex": "^3.1.0",
|
|
54
|
-
"next-themes": "^0.4.6",
|
|
55
|
-
"openai": "^6.1.0",
|
|
56
|
-
"react": "^19.2.0",
|
|
57
|
-
"react-dom": "^19.2.0",
|
|
58
|
-
"react-icons": "^5.5.0",
|
|
59
|
-
"react-markdown": "^10.1.0",
|
|
60
|
-
"react-use": "^17.6.0",
|
|
61
|
-
"remark-breaks": "^4.0.0",
|
|
62
|
-
"remark-gfm": "^4.0.1",
|
|
63
|
-
"search-params": "^4.0.1"
|
|
64
|
-
},
|
|
65
|
-
"devDependencies": {
|
|
66
|
-
"@anthropic-ai/claude-code": "^2.0.8",
|
|
67
|
-
"@google/gemini-cli": "^0.7.0",
|
|
68
|
-
"@types/node": "^24.6.2",
|
|
69
|
-
"@types/react": "^19.2.0",
|
|
70
|
-
"@types/react-dom": "^19.2.0",
|
|
71
|
-
"typescript": "^5.9.3",
|
|
72
|
-
"vercel": "^48.2.0"
|
|
19
|
+
"react": "^19.2.0"
|
|
73
20
|
}
|
|
74
21
|
}
|
package/packages/action.tsx
CHANGED
package/packages/fields.tsx
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import React, {
|
|
3
|
-
import { Input, Text, Button, Image, HStack, Spinner, Textarea } from '@chakra-ui/react'
|
|
4
|
-
import { createContext } from 'react'
|
|
5
|
-
import z from 'zod'
|
|
2
|
+
import React, { createContext, useCallback, useState } from 'react'
|
|
6
3
|
|
|
7
4
|
export type FieldsProps<T> = { defaults?: Partial<T> }
|
|
8
5
|
|
|
@@ -41,130 +38,20 @@ export function FieldsProvider<T>({children, ...props}: FieldsProps<T> & {
|
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
export const useFields = <T,>() => {
|
|
41
|
+
|
|
44
42
|
const context = React.useContext(Context)
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
if (context === undefined)
|
|
46
45
|
throw new Error('useFields must be used within a FieldsProvider')
|
|
47
|
-
|
|
46
|
+
|
|
48
47
|
return context as ReturnType<typeof useFieldsProvider<T>>
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
export const useField = <T,>(fieldName: keyof T) => {
|
|
52
51
|
const { fields, setField } = useFields<T>()
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
return {
|
|
55
54
|
value: fields[fieldName],
|
|
56
55
|
setValue: setField
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
export interface Field<T> {
|
|
61
|
-
type: string
|
|
62
|
-
View(props: { table: string, field: string, type: z.ZodTypeAny, value: T }): React.ReactElement
|
|
63
|
-
Edit(props: { table: string, field: string, type: z.ZodTypeAny, value: T, setValue: (value: T) => void }): React.ReactElement
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const string: Field<string> = {
|
|
67
|
-
type: 'string',
|
|
68
|
-
View({ type, value }) {
|
|
69
|
-
return <Text>{value}</Text>
|
|
70
|
-
},
|
|
71
|
-
Edit({ type, value, setValue }) {
|
|
72
|
-
return <Input value={value} onChange={e => setValue(e.target.value)} />
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const textarea: Field<string> = {
|
|
77
|
-
type: 'textarea',
|
|
78
|
-
View({ type, value }) {
|
|
79
|
-
return <Text whiteSpace='pre-wrap'>{value}</Text>
|
|
80
|
-
},
|
|
81
|
-
Edit({ type, value, setValue }) {
|
|
82
|
-
return <Textarea value={value || ''} onChange={e => setValue(e.target.value)} rows={5} />
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const file: Field<string> = {
|
|
87
|
-
type: 'file',
|
|
88
|
-
View({ type, value }) {
|
|
89
|
-
if (!value) return <Text>-</Text>
|
|
90
|
-
return <Image src={value} alt='file' boxSize='64px' objectFit='cover' />
|
|
91
|
-
},
|
|
92
|
-
Edit({ type, value, setValue }) {
|
|
93
|
-
const inputRef = useRef<HTMLInputElement | null>(null)
|
|
94
|
-
const [loading, setLoading] = useState(false)
|
|
95
|
-
|
|
96
|
-
async function handleFile(e: React.ChangeEvent<HTMLInputElement>) {
|
|
97
|
-
const file = e.target.files?.[0]
|
|
98
|
-
if (!file) return
|
|
99
|
-
setLoading(true)
|
|
100
|
-
try {
|
|
101
|
-
const fd = new FormData()
|
|
102
|
-
fd.append('file', file)
|
|
103
|
-
const res = await fetch('/api/upload', {
|
|
104
|
-
method: 'POST',
|
|
105
|
-
body: fd,
|
|
106
|
-
})
|
|
107
|
-
const json = await res.json()
|
|
108
|
-
if (json.url) setValue(json.url)
|
|
109
|
-
} finally {
|
|
110
|
-
setLoading(false)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<HStack>
|
|
116
|
-
<input ref={inputRef} type='file' hidden onChange={handleFile} />
|
|
117
|
-
<Button onClick={() => inputRef.current?.click()}>{loading ? <Spinner size='xs'/> : 'Upload'}</Button>
|
|
118
|
-
{value ? <Image src={value} alt='preview' boxSize='64px' objectFit='cover' /> : null}
|
|
119
|
-
</HStack>
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function EditField<T, FieldName extends keyof T = keyof T, FieldType extends typeof fields[keyof typeof fields] = typeof fields[keyof typeof fields]>({attribute, field, table, type}: {attribute: FieldName, table: string, field: FieldType, type: z.ZodTypeAny}) {
|
|
125
|
-
|
|
126
|
-
const { value, setValue } = useField<T>(attribute)
|
|
127
|
-
|
|
128
|
-
const Edit = field['Edit']
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<Edit
|
|
132
|
-
table={table}
|
|
133
|
-
// @ts-expect-error
|
|
134
|
-
value={value}
|
|
135
|
-
// @ts-expect-error
|
|
136
|
-
setValue={setValue}
|
|
137
|
-
type={type} />
|
|
138
|
-
)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function ViewField<T, FieldName extends keyof T, FieldType extends keyof typeof fields>({attribute, field, type}: {attribute: FieldName, field: FieldType, type: z.ZodTypeAny}) {
|
|
142
|
-
|
|
143
|
-
const { value } = useField<T>(attribute)
|
|
144
|
-
|
|
145
|
-
const View = fields[field]['View']
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
// @ts-expect-error
|
|
149
|
-
<View value={value} type={type} />
|
|
150
|
-
)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const record: Field<string> = {
|
|
154
|
-
type: 'record',
|
|
155
|
-
View: () => <></>,
|
|
156
|
-
Edit: () => <></>,
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const records: Field<string> = {
|
|
160
|
-
type: 'record',
|
|
161
|
-
View: () => <></>,
|
|
162
|
-
Edit: () => <></>,
|
|
163
|
-
}
|
|
164
|
-
export const fields = {
|
|
165
|
-
string,
|
|
166
|
-
textarea,
|
|
167
|
-
file,
|
|
168
|
-
record,
|
|
169
|
-
records,
|
|
170
|
-
}
|
package/packages/form.tsx
CHANGED
|
@@ -11,7 +11,7 @@ export function Form<Fields, Result>({children, ...params}: FormProps<Fields, Re
|
|
|
11
11
|
return (
|
|
12
12
|
<FieldsProvider<Fields> defaults={params.defaults}>
|
|
13
13
|
{fields => (
|
|
14
|
-
<ActionProvider<Fields, Result> params={fields.fields} action={params.action}
|
|
14
|
+
<ActionProvider<Fields, Result> params={fields.fields} action={params.action} autoTrigger={params.autoTrigger} onError={params.onError}>
|
|
15
15
|
{form => (
|
|
16
16
|
typeof children === 'function' ? children({...fields, ...form}) : children
|
|
17
17
|
)}
|
|
@@ -20,18 +20,3 @@ export function Form<Fields, Result>({children, ...params}: FormProps<Fields, Re
|
|
|
20
20
|
</FieldsProvider>
|
|
21
21
|
)
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
/** Nested example
|
|
25
|
-
<Form<{A: 'A', B: 'B', C: 'C'}, {result: 'Final'}> params={{}} action={(props) => {return fetch('/some-data', { body: JSON.stringify(props) }).then(res => res.json())}}>
|
|
26
|
-
{top => (
|
|
27
|
-
<>
|
|
28
|
-
<Form<{param: 1}, {result: 'A'}> params={{}} action={(props) => {return fetch('/getA', { body: JSON.stringify(props) }).then(res => res.json())}} onResult={({result}) => top.setField('A', result)}>
|
|
29
|
-
</Form>
|
|
30
|
-
<Form<{param: 'A'}, {result: 'B'}> params={{}} action={(props) => {return fetch('/getB', { body: JSON.stringify(props) }).then(res => res.json())}} onResult={({result}) => top.setField('B', result)}>
|
|
31
|
-
</Form>
|
|
32
|
-
<Form<{param: 'B'}, {result: 'C'}> params={{}} action={(props) => {return fetch('/getC', { body: JSON.stringify(props) }).then(res => res.json())}} onResult={({result}) => top.setField('C', result)}>
|
|
33
|
-
</Form>
|
|
34
|
-
</>
|
|
35
|
-
)}
|
|
36
|
-
</Form>
|
|
37
|
-
*/
|