@rolder/kit 3.0.0-alpha.6 → 3.0.0-alpha.61
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/dist/ai/index.d.ts +2 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/ui/{conversation → chat}/Empty.js +4 -4
- package/dist/ai/ui/chat/File.d.ts +3 -0
- package/dist/ai/ui/{conversation → chat}/File.js +9 -8
- package/dist/ai/ui/chat/FileIcon.js +43 -0
- package/dist/ai/ui/{conversation → chat}/Loader.js +4 -3
- package/dist/ai/ui/chat/Message.d.ts +3 -0
- package/dist/ai/ui/chat/Message.js +27 -0
- package/dist/ai/ui/chat/Messages.d.ts +7 -0
- package/dist/ai/ui/chat/Messages.js +11 -0
- package/dist/ai/ui/chat/Root.d.ts +11 -0
- package/dist/ai/ui/chat/Root.js +31 -0
- package/dist/ai/ui/chat/chatInput/File.js +71 -0
- package/dist/ai/ui/chat/chatInput/FileIcon.js +43 -0
- package/dist/ai/ui/chat/chatInput/Root.d.ts +9 -0
- package/dist/ai/ui/chat/chatInput/Root.js +24 -0
- package/dist/ai/ui/chat/chatInput/Submit.js +23 -0
- package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.js +8 -7
- package/dist/ai/ui/{promptInput → chat/chatInput}/index.d.ts +2 -3
- package/dist/ai/ui/{promptInput → chat/chatInput}/index.js +2 -2
- package/dist/ai/ui/chat/chatInput/store/file.d.ts +8 -0
- package/dist/ai/ui/chat/chatInput/store/file.js +32 -0
- package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/fileErrorNotificaton.js +21 -0
- package/dist/ai/ui/chat/chatInput/store/index.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/index.js +2 -0
- package/dist/ai/ui/chat/chatInput/store/input.d.ts +13 -0
- package/dist/ai/ui/chat/chatInput/store/input.js +81 -0
- package/dist/ai/ui/chat/chatInput/store/parseFile.d.ts +2 -0
- package/dist/ai/ui/chat/chatInput/store/parseFile.js +23 -0
- package/dist/ai/ui/chat/index.d.ts +16 -0
- package/dist/ai/ui/{conversation → chat}/index.js +6 -3
- package/dist/ai/ui/chat/store/index.d.ts +5 -0
- package/dist/ai/ui/chat/store/index.js +5 -0
- package/dist/ai/ui/chat/store/messageIds.d.ts +8 -0
- package/dist/ai/ui/chat/store/messageIds.js +41 -0
- package/dist/ai/ui/chat/store/messagesMap.d.ts +5 -0
- package/dist/ai/ui/chat/store/messagesMap.js +15 -0
- package/dist/ai/ui/chat/store/send.d.ts +14 -0
- package/dist/ai/ui/chat/store/send.js +16 -0
- package/dist/ai/ui/chat/store/states.d.ts +11 -0
- package/dist/ai/ui/chat/store/states.js +17 -0
- package/dist/ai/ui/chat/store/useInitChat.d.ts +3 -0
- package/dist/ai/ui/chat/store/useInitChat.js +40 -0
- package/dist/ai/ui/index.d.ts +1 -0
- package/dist/ai/ui/index.js +1 -0
- package/dist/ai/utils/index.d.ts +2 -0
- package/dist/ai/utils/index.js +2 -0
- package/dist/app/AppDefaults.js +1 -1
- package/dist/app/DefaultApp.js +1 -1
- package/dist/app/cookieColorSchemeManager.js +1 -1
- package/dist/app/defaultTheme.d.ts +1 -1
- package/dist/app/index.d.ts +4 -0
- package/dist/app/index.js +4 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/index.d.ts +5 -26
- package/dist/index.js +5 -26
- package/dist/styles.css +3 -3
- package/dist/tanstackFunctions/cookie/index.d.ts +3 -0
- package/dist/tanstackFunctions/cookie/index.js +4 -0
- package/dist/tanstackFunctions/index.d.ts +2 -0
- package/dist/tanstackFunctions/index.js +2 -0
- package/dist/tanstackFunctions/s3/getS3Client.d.ts +2 -0
- package/dist/tanstackFunctions/s3/getS3Client.js +18 -0
- package/dist/tanstackFunctions/s3/getSignedFileUrlFn.d.ts +4 -0
- package/dist/tanstackFunctions/s3/getSignedFileUrlFn.js +21 -0
- package/dist/tanstackFunctions/s3/index.d.ts +2 -0
- package/dist/tanstackFunctions/s3/index.js +2 -0
- package/dist/tanstackFunctions/s3/uploadRequest.d.ts +3 -0
- package/dist/tanstackFunctions/s3/uploadRequest.js +21 -0
- package/dist/ui/AnimatedChevron.d.ts +2 -2
- package/dist/ui/AnimatedChevron.js +7 -25
- package/dist/ui/JsonInput.js +1 -1
- package/dist/ui/editor/Toolbar.js +4 -22
- package/dist/ui/form/buttons/CancelButton.js +4 -26
- package/dist/ui/form/buttons/SubmitButton.js +4 -29
- package/dist/ui/form/fields/TextPassowrdField.js +4 -26
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/scrollArea/ScrollArea.d.ts +1 -1
- package/dist/ui/scrollArea/ScrollAreaButton.d.ts +1 -1
- package/dist/ui/scrollArea/ScrollAreaButton.js +7 -28
- package/package.json +38 -26
- package/dist/ai/ui/conversation/ConversationContext.d.ts +0 -7
- package/dist/ai/ui/conversation/ConversationContext.js +0 -8
- package/dist/ai/ui/conversation/ConversationProvider.d.ts +0 -2
- package/dist/ai/ui/conversation/ConversationProvider.js +0 -14
- package/dist/ai/ui/conversation/File.d.ts +0 -4
- package/dist/ai/ui/conversation/FileIcon.js +0 -225
- package/dist/ai/ui/conversation/Message.d.ts +0 -4
- package/dist/ai/ui/conversation/Message.js +0 -25
- package/dist/ai/ui/conversation/Root.d.ts +0 -2
- package/dist/ai/ui/conversation/Root.js +0 -26
- package/dist/ai/ui/conversation/index.d.ts +0 -13
- package/dist/ai/ui/conversation/types.d.ts +0 -7
- package/dist/ai/ui/conversation/types.js +0 -0
- package/dist/ai/ui/conversation/useChatMessage.d.ts +0 -2
- package/dist/ai/ui/conversation/useChatMessage.js +0 -12
- package/dist/ai/ui/promptInput/File.js +0 -117
- package/dist/ai/ui/promptInput/FileIcon.js +0 -225
- package/dist/ai/ui/promptInput/PromptInputContext.d.ts +0 -12
- package/dist/ai/ui/promptInput/PromptInputContext.js +0 -8
- package/dist/ai/ui/promptInput/PromptInputProvider.d.ts +0 -2
- package/dist/ai/ui/promptInput/PromptInputProvider.js +0 -50
- package/dist/ai/ui/promptInput/Root.d.ts +0 -3
- package/dist/ai/ui/promptInput/Root.js +0 -17
- package/dist/ai/ui/promptInput/Submit.js +0 -40
- package/dist/ai/ui/promptInput/types.d.ts +0 -11
- package/dist/ai/ui/promptInput/types.js +0 -0
- package/dist/surreal/connection.d.ts +0 -9
- package/dist/surreal/connection.js +0 -49
- package/dist/surreal/deafaultCrud.d.ts +0 -2
- package/dist/surreal/deafaultCrud.js +0 -18
- package/dist/surreal/deserialize.d.ts +0 -17
- package/dist/surreal/deserialize.js +0 -46
- package/dist/surreal/encryption.d.ts +0 -6
- package/dist/surreal/encryption.js +0 -30
- /package/dist/ai/ui/{conversation → chat}/Empty.d.ts +0 -0
- /package/dist/ai/ui/{conversation → chat}/FileIcon.d.ts +0 -0
- /package/dist/ai/ui/{conversation → chat}/Loader.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/File.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/FileIcon.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Footer.js +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Submit.d.ts +0 -0
- /package/dist/ai/ui/{promptInput → chat/chatInput}/Textarea.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/getCookie.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/getCookie.js +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookie.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookie.js +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookies.d.ts +0 -0
- /package/dist/{functions → tanstackFunctions/cookie}/setCookies.js +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import mammoth from "mammoth";
|
|
2
|
+
import { read, utils } from "xlsx";
|
|
3
|
+
const parseExcel = async (file)=>{
|
|
4
|
+
const buffer = await file.arrayBuffer();
|
|
5
|
+
const workbook = read(buffer, {
|
|
6
|
+
type: 'array',
|
|
7
|
+
cellDates: true
|
|
8
|
+
});
|
|
9
|
+
const sheetName = workbook.SheetNames[0];
|
|
10
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
11
|
+
const jsonData = utils.sheet_to_json(worksheet, {
|
|
12
|
+
dateNF: 'yyyy-mm-dd'
|
|
13
|
+
});
|
|
14
|
+
return JSON.stringify(jsonData, null, 2);
|
|
15
|
+
};
|
|
16
|
+
const parseWord = async (file)=>{
|
|
17
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
18
|
+
const { value } = await mammoth.convertToHtml({
|
|
19
|
+
arrayBuffer
|
|
20
|
+
});
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
export { parseExcel, parseWord };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const Chat: {
|
|
2
|
+
Root: ({ children, scrollAreaProps, withScrollButton, chatOptions, ...props }: import("./Root").ConversationRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Messages: ({ children, ...props }: Omit<import("@mantine/core").StackProps, "children"> & {
|
|
4
|
+
children: (messageId: string) => import("react").ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Message: import("react").MemoExoticComponent<({ messageId }: {
|
|
7
|
+
messageId: string;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
9
|
+
File: ({ messageId }: {
|
|
10
|
+
messageId: string;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
Loader: (props: import("@mantine/core").LoaderProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
Empty: () => import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
};
|
|
15
|
+
export { ChatInput } from './chatInput';
|
|
16
|
+
export * from './store';
|
|
@@ -2,13 +2,16 @@ import { Empty } from "./Empty.js";
|
|
|
2
2
|
import { File } from "./File.js";
|
|
3
3
|
import { Loader } from "./Loader.js";
|
|
4
4
|
import { Message } from "./Message.js";
|
|
5
|
+
import { Messages } from "./Messages.js";
|
|
5
6
|
import { Root } from "./Root.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
7
|
+
import { ChatInput } from "./chatInput/index.js";
|
|
8
|
+
export * from "./store/index.js";
|
|
9
|
+
const Chat = {
|
|
8
10
|
Root: Root,
|
|
11
|
+
Messages: Messages,
|
|
9
12
|
Message: Message,
|
|
10
13
|
File: File,
|
|
11
14
|
Loader: Loader,
|
|
12
15
|
Empty: Empty
|
|
13
16
|
};
|
|
14
|
-
export {
|
|
17
|
+
export { Chat, ChatInput };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UIMessage } from 'ai';
|
|
2
|
+
export declare const $chatMessageIds: import("nanostores").PreinitializedWritableAtom<string[]> & object;
|
|
3
|
+
export declare const getChatMessages: <T extends UIMessage>() => T[];
|
|
4
|
+
export declare const useChatMessageIds: () => string[];
|
|
5
|
+
export declare const addChatMessage: (newMessage: UIMessage) => void;
|
|
6
|
+
export declare const setChatMessages: <T extends UIMessage>(messages: T[]) => void;
|
|
7
|
+
export declare const getIsEmpty: () => boolean;
|
|
8
|
+
export declare const useIsEmpty: () => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useStore } from "@nanostores/react";
|
|
2
|
+
import { atom, computed, onSet } from "nanostores";
|
|
3
|
+
import { $chatMessages } from "./messagesMap.js";
|
|
4
|
+
const $chatMessageIds = atom([]);
|
|
5
|
+
const getChatMessages = ()=>$chatMessageIds.get().map((id)=>$chatMessages.get()[id]);
|
|
6
|
+
const useChatMessageIds = ()=>useStore($chatMessageIds);
|
|
7
|
+
onSet($chatMessageIds, ({ newValue, abort })=>{
|
|
8
|
+
const currentValue = $chatMessageIds.get();
|
|
9
|
+
if (currentValue.length === newValue.length && currentValue.every((id, index)=>id === newValue[index])) abort();
|
|
10
|
+
});
|
|
11
|
+
const addChatMessage = (newMessage)=>{
|
|
12
|
+
$chatMessageIds.set([
|
|
13
|
+
...$chatMessageIds.get(),
|
|
14
|
+
newMessage.id
|
|
15
|
+
]);
|
|
16
|
+
$chatMessages.set({
|
|
17
|
+
...$chatMessages.get(),
|
|
18
|
+
[newMessage.id]: newMessage
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const setChatMessages = (messages)=>{
|
|
22
|
+
const newIds = messages.map((msg)=>msg.id);
|
|
23
|
+
$chatMessageIds.set(newIds);
|
|
24
|
+
const currentMessages = $chatMessages.get();
|
|
25
|
+
const lastMessage = messages[messages.length - 1];
|
|
26
|
+
for(let i = 0; i < messages.length; i++){
|
|
27
|
+
const msg = messages[i];
|
|
28
|
+
const currentMsg = currentMessages[msg.id];
|
|
29
|
+
const isLastMessage = msg === lastMessage;
|
|
30
|
+
if (currentMsg) if (isLastMessage) $chatMessages.setKey(msg.id, msg);
|
|
31
|
+
else {
|
|
32
|
+
const isChanged = JSON.stringify(currentMsg) !== JSON.stringify(msg);
|
|
33
|
+
if (isChanged) $chatMessages.setKey(msg.id, msg);
|
|
34
|
+
}
|
|
35
|
+
else $chatMessages.setKey(msg.id, msg);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const $isEmpty = computed($chatMessageIds, (messages)=>0 === messages.length);
|
|
39
|
+
const getIsEmpty = ()=>$isEmpty.get();
|
|
40
|
+
const useIsEmpty = ()=>useStore($isEmpty);
|
|
41
|
+
export { $chatMessageIds, addChatMessage, getChatMessages, getIsEmpty, setChatMessages, useChatMessageIds, useIsEmpty };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { UIDataTypes, UIMessage, UIMessagePart, UITools } from 'ai';
|
|
2
|
+
export declare const $chatMessages: import("nanostores").PreinitializedMapStore<Record<string, UIMessage<unknown, UIDataTypes, UITools>>> & object;
|
|
3
|
+
export declare const getChatMessage: (messageId: string) => UIMessage<unknown, UIDataTypes, UITools>;
|
|
4
|
+
export declare const useChatMessage: <T extends UIMessage>(messageId: string) => T;
|
|
5
|
+
export declare const useChatMessagePart: <M extends UIMessage, T extends UIMessagePart<UIDataTypes, UITools>>(messageId: string, type?: T["type"]) => T | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useStore } from "@nanostores/react";
|
|
2
|
+
import { map } from "nanostores";
|
|
3
|
+
const $chatMessages = map({});
|
|
4
|
+
const getChatMessage = (messageId)=>$chatMessages.get()[messageId];
|
|
5
|
+
const useChatMessage = (messageId)=>useStore($chatMessages, {
|
|
6
|
+
keys: [
|
|
7
|
+
messageId
|
|
8
|
+
]
|
|
9
|
+
})[messageId];
|
|
10
|
+
const useChatMessagePart = (messageId, type)=>{
|
|
11
|
+
const message = useChatMessage(messageId);
|
|
12
|
+
const part = message?.parts?.find((i)=>i.type === type);
|
|
13
|
+
return part;
|
|
14
|
+
};
|
|
15
|
+
export { $chatMessages, getChatMessage, useChatMessage, useChatMessagePart };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FileUIPart } from 'ai';
|
|
2
|
+
export type SendMessage = ({ text, file }: {
|
|
3
|
+
text: string;
|
|
4
|
+
file?: FileUIPart;
|
|
5
|
+
}, data?: Record<string, unknown>) => Promise<void>;
|
|
6
|
+
type SendSdkMessage = ({ text, files }: {
|
|
7
|
+
text: string;
|
|
8
|
+
files?: FileUIPart[];
|
|
9
|
+
}, { body }: {
|
|
10
|
+
body?: Record<string, unknown>;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
export declare const setChatSendMessage: (sendMessage: SendSdkMessage) => void;
|
|
13
|
+
export declare const sendMessage: SendMessage;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { atom } from "nanostores";
|
|
2
|
+
const $chatSendMessage = atom();
|
|
3
|
+
const getChatSendMessage = ()=>$chatSendMessage.get();
|
|
4
|
+
const setChatSendMessage = (sendMessage)=>$chatSendMessage.set(sendMessage);
|
|
5
|
+
const send_sendMessage = async ({ text, file }, data)=>{
|
|
6
|
+
const files = file ? [
|
|
7
|
+
file
|
|
8
|
+
] : [];
|
|
9
|
+
await getChatSendMessage()?.({
|
|
10
|
+
text,
|
|
11
|
+
files
|
|
12
|
+
}, {
|
|
13
|
+
body: data
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { send_sendMessage as sendMessage, setChatSendMessage };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChatStatus } from 'ai';
|
|
2
|
+
export declare const getChatStatus: () => ChatStatus;
|
|
3
|
+
export declare const setChatStatus: (status: ChatStatus) => void;
|
|
4
|
+
export declare const useChatStatus: () => ChatStatus;
|
|
5
|
+
export declare const getIsLoading: () => boolean;
|
|
6
|
+
export declare const useIsLoading: () => boolean;
|
|
7
|
+
export declare const getIsStreaming: () => boolean;
|
|
8
|
+
export declare const useIsStreaming: () => boolean;
|
|
9
|
+
export declare const getChatError: () => string | undefined;
|
|
10
|
+
export declare const setChatError: (error: string | undefined) => void;
|
|
11
|
+
export declare const useChatError: () => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useStore } from "@nanostores/react";
|
|
2
|
+
import { atom, computed } from "nanostores";
|
|
3
|
+
const $chatStatus = atom('ready');
|
|
4
|
+
const getChatStatus = ()=>$chatStatus.get();
|
|
5
|
+
const setChatStatus = (status)=>$chatStatus.set(status);
|
|
6
|
+
const useChatStatus = ()=>useStore($chatStatus);
|
|
7
|
+
const $isLoading = computed($chatStatus, (status)=>'ready' !== status);
|
|
8
|
+
const getIsLoading = ()=>$isLoading.get();
|
|
9
|
+
const useIsLoading = ()=>useStore($isLoading);
|
|
10
|
+
const $isStreaming = computed($chatStatus, (status)=>'streaming' === status);
|
|
11
|
+
const getIsStreaming = ()=>$isStreaming.get();
|
|
12
|
+
const useIsStreaming = ()=>useStore($isStreaming);
|
|
13
|
+
const $chatError = atom();
|
|
14
|
+
const getChatError = ()=>$chatError.get();
|
|
15
|
+
const setChatError = (error)=>$chatError.set(error);
|
|
16
|
+
const useChatError = ()=>useStore($chatError);
|
|
17
|
+
export { getChatError, getChatStatus, getIsLoading, getIsStreaming, setChatError, setChatStatus, useChatError, useChatStatus, useIsLoading, useIsStreaming };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useChat } from "@ai-sdk/react";
|
|
2
|
+
import { notifications } from "@mantine/notifications";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { setChatMessages } from "./messageIds.js";
|
|
5
|
+
import { setChatSendMessage } from "./send.js";
|
|
6
|
+
import { setChatError, setChatStatus } from "./states.js";
|
|
7
|
+
const useInitChat = (props)=>{
|
|
8
|
+
const { messages, status, error, sendMessage } = useChat({
|
|
9
|
+
onError: (e)=>{
|
|
10
|
+
notifications.show({
|
|
11
|
+
title: 'Ошибка сервера ИИ',
|
|
12
|
+
message: e.message,
|
|
13
|
+
color: 'red',
|
|
14
|
+
autoClose: false
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
useEffect(()=>{
|
|
20
|
+
setChatStatus(status);
|
|
21
|
+
}, [
|
|
22
|
+
status
|
|
23
|
+
]);
|
|
24
|
+
useEffect(()=>{
|
|
25
|
+
setChatError(error?.message);
|
|
26
|
+
}, [
|
|
27
|
+
error?.message
|
|
28
|
+
]);
|
|
29
|
+
useEffect(()=>{
|
|
30
|
+
setChatSendMessage(sendMessage);
|
|
31
|
+
}, [
|
|
32
|
+
sendMessage
|
|
33
|
+
]);
|
|
34
|
+
useEffect(()=>{
|
|
35
|
+
setChatMessages(messages);
|
|
36
|
+
}, [
|
|
37
|
+
messages
|
|
38
|
+
]);
|
|
39
|
+
};
|
|
40
|
+
export { useInitChat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './chat';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chat/index.js";
|
package/dist/app/AppDefaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useComputedColorScheme } from "@mantine/core";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { setCookies } from "../
|
|
3
|
+
import { setCookies } from "../tanstackFunctions/index.js";
|
|
4
4
|
const AppDefaults = ({ saveColorScheme })=>{
|
|
5
5
|
const colorScheme = useComputedColorScheme();
|
|
6
6
|
useEffect(()=>{
|
package/dist/app/DefaultApp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ColorSchemeScript, MantineProvider } from "@mantine/core";
|
|
3
3
|
import { HeadContent, Scripts } from "@tanstack/react-router";
|
|
4
|
-
import { getCookie } from "../
|
|
4
|
+
import { getCookie } from "../tanstackFunctions/index.js";
|
|
5
5
|
import { AppDefaults } from "./AppDefaults.js";
|
|
6
6
|
import { cookieColorSchemeManager } from "./cookieColorSchemeManager.js";
|
|
7
7
|
import { defaultTheme } from "./defaultTheme.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isMantineColorScheme } from "@mantine/core";
|
|
2
2
|
import { atom } from "nanostores";
|
|
3
|
-
import { setCookie } from "../
|
|
3
|
+
import { setCookie } from "../tanstackFunctions/index.js";
|
|
4
4
|
const $colorScheme = atom();
|
|
5
5
|
let unsubscribeSystemTheme;
|
|
6
6
|
const cookieColorSchemeManager = ({ key = 'colorScheme' } = {})=>({
|
|
@@ -6,9 +6,9 @@ export declare const defaultTheme: {
|
|
|
6
6
|
black?: string | undefined;
|
|
7
7
|
colors?: {
|
|
8
8
|
[x: string & {}]: import("@mantine/core").MantineColorsTuple | undefined;
|
|
9
|
+
red?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
9
10
|
dark?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
10
11
|
gray?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
11
|
-
red?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
12
12
|
pink?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
13
13
|
grape?: import("@mantine/core").MantineColorsTuple | undefined;
|
|
14
14
|
violet?: import("@mantine/core").MantineColorsTuple | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export { DefaultApp } from './app/DefaultApp';
|
|
7
|
-
export { defaultRequestMiddlewares } from './app/defaultRequestMiddlewares';
|
|
8
|
-
export { defaultTheme } from './app/defaultTheme';
|
|
9
|
-
export { getCookie } from './functions/getCookie';
|
|
10
|
-
export { setCookie } from './functions/setCookie';
|
|
11
|
-
export { setCookies } from './functions/setCookies';
|
|
12
|
-
export { useMutation } from './hooks/useMutation';
|
|
13
|
-
export { useMutationWithInvalidate } from './hooks/useMutationWithInvalidate';
|
|
14
|
-
export { getDB } from './surreal/connection';
|
|
15
|
-
export { surrealDeleteFn, surrealUnsubscribeFn } from './surreal/deafaultCrud';
|
|
16
|
-
export { deserialize } from './surreal/deserialize';
|
|
17
|
-
export { encryptionFn } from './surreal/encryption';
|
|
18
|
-
export { Editor, useEditor } from './ui/editor';
|
|
19
|
-
export { DefaultError, DefaultNotFound, defaultErrorNotification, Forbidden, } from './ui/error';
|
|
20
|
-
export { AnimatedChevron } from './ui/AnimatedChevron';
|
|
21
|
-
export { useAppForm, useFieldContext, withForm, blurOnError, fieldsSchema, } from './ui/form';
|
|
22
|
-
export { HoverPaper, usePaperHover } from './ui/hoverPaper';
|
|
23
|
-
export { JsonInput } from './ui/JsonInput';
|
|
24
|
-
export { RouterLink } from './ui/RouterLink';
|
|
25
|
-
export { SaveInput } from './ui/saveInput';
|
|
26
|
-
export { ScrollArea, useScrollArea, type ScrollAreaContextValue, type ScrollAreaHook, type ScrollAreaProps, type ScrollAreaState, type ScrollButtonProps, type ScrollPosition, } from './ui/scrollArea';
|
|
1
|
+
export * from './ai';
|
|
2
|
+
export * from './app';
|
|
3
|
+
export * from './hooks';
|
|
4
|
+
export * from './tanstackFunctions';
|
|
5
|
+
export * from './ui';
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { defaultRequestMiddlewares } from "./app/defaultRequestMiddlewares.js";
|
|
7
|
-
import { defaultTheme } from "./app/defaultTheme.js";
|
|
8
|
-
import { getCookie } from "./functions/getCookie.js";
|
|
9
|
-
import { setCookie } from "./functions/setCookie.js";
|
|
10
|
-
import { setCookies } from "./functions/setCookies.js";
|
|
11
|
-
import { useMutation } from "./hooks/useMutation.js";
|
|
12
|
-
import { useMutationWithInvalidate } from "./hooks/useMutationWithInvalidate.js";
|
|
13
|
-
import { getDB } from "./surreal/connection.js";
|
|
14
|
-
import { surrealDeleteFn, surrealUnsubscribeFn } from "./surreal/deafaultCrud.js";
|
|
15
|
-
import { deserialize } from "./surreal/deserialize.js";
|
|
16
|
-
import { encryptionFn } from "./surreal/encryption.js";
|
|
17
|
-
import { Editor, useEditor } from "./ui/editor/index.js";
|
|
18
|
-
import { DefaultError, DefaultNotFound, Forbidden, defaultErrorNotification } from "./ui/error/index.js";
|
|
19
|
-
import { AnimatedChevron } from "./ui/AnimatedChevron.js";
|
|
20
|
-
import { blurOnError, fieldsSchema, useAppForm, useFieldContext, withForm } from "./ui/form/index.js";
|
|
21
|
-
import { HoverPaper, usePaperHover } from "./ui/hoverPaper/index.js";
|
|
22
|
-
import { JsonInput } from "./ui/JsonInput.js";
|
|
23
|
-
import { RouterLink } from "./ui/RouterLink.js";
|
|
24
|
-
import { SaveInput } from "./ui/saveInput/index.js";
|
|
25
|
-
import { ScrollArea, useScrollArea } from "./ui/scrollArea/index.js";
|
|
26
|
-
export { AnimatedChevron, Conversation, DefaultApp, DefaultError, DefaultNotFound, Editor, Forbidden, HoverPaper, JsonInput, PromptInput, RouterLink, SaveInput, ScrollArea, blurOnError, convertFileUIPartBlobToDataURL, defaultErrorNotification, defaultRequestMiddlewares, defaultTheme, deserialize, encryptionFn, fieldsSchema, getCookie, getDB, parseAiMessagePart, setCookie, setCookies, surrealDeleteFn, surrealUnsubscribeFn, useAppForm, useChatMessage, useEditor, useFieldContext, useMutation, useMutationWithInvalidate, usePaperHover, useScrollArea, withForm };
|
|
1
|
+
export * from "./ai/index.js";
|
|
2
|
+
export * from "./app/index.js";
|
|
3
|
+
export * from "./hooks/index.js";
|
|
4
|
+
export * from "./tanstackFunctions/index.js";
|
|
5
|
+
export * from "./ui/index.js";
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.rolder-
|
|
1
|
+
.rolder-chat-input-root {
|
|
2
2
|
background-color: light-dark(var(--mantine-color-white), var(--mantine-color-dark-6));
|
|
3
3
|
|
|
4
4
|
&:focus-within {
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.rolder-
|
|
11
|
+
.rolder-chat-input-textarea {
|
|
12
12
|
border: 0;
|
|
13
13
|
border-radius: 8px;
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.rolder-
|
|
17
|
+
.rolder-chat-input-file-action-action {
|
|
18
18
|
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
|
|
19
19
|
|
|
20
20
|
&[data-disabled] {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { custom } from "@better-upload/server/clients";
|
|
2
|
+
const getS3Client = ()=>{
|
|
3
|
+
const host = process.env.S3_HOST;
|
|
4
|
+
if (!host) throw new Error('S3_HOST environment variable is not set');
|
|
5
|
+
const region = process.env.S3_REGION;
|
|
6
|
+
if (!region) throw new Error('S3_REGION environment variable is not set');
|
|
7
|
+
const accessKeyId = process.env.S3_ACCESS_KEY_ID;
|
|
8
|
+
if (!accessKeyId) throw new Error('S3_ACCESS_KEY_ID environment variable is not set');
|
|
9
|
+
const accessKeySecret = process.env.S3_ACCESS_KEY_SECRET;
|
|
10
|
+
if (!accessKeySecret) throw new Error('S3_ACCESS_KEY_SECRET environment variable is not set');
|
|
11
|
+
return custom({
|
|
12
|
+
host,
|
|
13
|
+
region,
|
|
14
|
+
accessKeyId,
|
|
15
|
+
secretAccessKey: accessKeySecret
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { getS3Client };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { presignGetObject } from "@better-upload/server/helpers";
|
|
2
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
3
|
+
import v4 from "zod/v4";
|
|
4
|
+
import { getS3Client } from "./getS3Client.js";
|
|
5
|
+
const Schema = v4.object({
|
|
6
|
+
s3Key: v4.string()
|
|
7
|
+
});
|
|
8
|
+
const getSignedFileUrlFn = createServerFn({
|
|
9
|
+
method: 'POST'
|
|
10
|
+
}).inputValidator(Schema).handler(async ({ data: { s3Key } })=>{
|
|
11
|
+
const bucket = process.env.S3_BUCKET_NAME;
|
|
12
|
+
if (!bucket) throw new Error('S3_BUCKET_NAME environment variable is not set');
|
|
13
|
+
const s3 = getS3Client();
|
|
14
|
+
const url = await presignGetObject(s3, {
|
|
15
|
+
bucket,
|
|
16
|
+
key: s3Key,
|
|
17
|
+
expiresIn: 300
|
|
18
|
+
});
|
|
19
|
+
return url;
|
|
20
|
+
});
|
|
21
|
+
export { getSignedFileUrlFn };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { handleRequest, route } from "@better-upload/server";
|
|
2
|
+
import { createServerOnlyFn } from "@tanstack/react-start";
|
|
3
|
+
import { getS3Client } from "./getS3Client.js";
|
|
4
|
+
const getRouter = createServerOnlyFn(()=>{
|
|
5
|
+
const bucket = process.env.BUCKET_NAME;
|
|
6
|
+
if (!bucket) throw new Error('BUCKET_NAME environment variable is not set');
|
|
7
|
+
const s3 = getS3Client();
|
|
8
|
+
const router = {
|
|
9
|
+
client: s3,
|
|
10
|
+
bucketName: bucket,
|
|
11
|
+
routes: {
|
|
12
|
+
upload: route({
|
|
13
|
+
multipleFiles: false,
|
|
14
|
+
maxFileSize: 52428800
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return router;
|
|
19
|
+
});
|
|
20
|
+
const uploadRequest = async ({ request })=>handleRequest(request, getRouter());
|
|
21
|
+
export { uploadRequest };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
interface Props extends
|
|
1
|
+
import { type IconProps } from '@tabler/icons-react';
|
|
2
|
+
interface Props extends IconProps {
|
|
3
3
|
expanded?: boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare const AnimatedChevron: ({ expanded, style, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
viewBox: "0 0 24 24",
|
|
7
|
-
fill: "none",
|
|
8
|
-
stroke: "currentColor",
|
|
9
|
-
strokeWidth: "1.5",
|
|
10
|
-
strokeLinecap: "round",
|
|
11
|
-
strokeLinejoin: "round",
|
|
12
|
-
role: "img",
|
|
13
|
-
"aria-label": "Chevron",
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconChevronDown } from "@tabler/icons-react";
|
|
3
|
+
const AnimatedChevron = ({ expanded, style, ...props })=>/*#__PURE__*/ jsx(IconChevronDown, {
|
|
4
|
+
strokeWidth: 1.5,
|
|
5
|
+
"data-expanded": expanded,
|
|
14
6
|
style: {
|
|
15
7
|
transition: 'transform 0.2s ease-in-out',
|
|
16
|
-
transform: expanded ? 'rotate(
|
|
8
|
+
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
17
9
|
...style
|
|
18
10
|
},
|
|
19
|
-
...props
|
|
20
|
-
children: [
|
|
21
|
-
/*#__PURE__*/ jsx("path", {
|
|
22
|
-
stroke: "none",
|
|
23
|
-
d: "M0 0h24v24H0z",
|
|
24
|
-
fill: "none"
|
|
25
|
-
}),
|
|
26
|
-
/*#__PURE__*/ jsx("path", {
|
|
27
|
-
d: "M6 9l6 6l6 -6"
|
|
28
|
-
})
|
|
29
|
-
]
|
|
11
|
+
...props
|
|
30
12
|
});
|
|
31
13
|
export { AnimatedChevron };
|
package/dist/ui/JsonInput.js
CHANGED
|
@@ -5,7 +5,7 @@ import { linter } from "@codemirror/lint";
|
|
|
5
5
|
import { keymap } from "@codemirror/view";
|
|
6
6
|
import { vscodeDark, vscodeLight } from "@uiw/codemirror-theme-vscode";
|
|
7
7
|
import react_codemirror from "@uiw/react-codemirror";
|
|
8
|
-
import { getCookie } from "../
|
|
8
|
+
import { getCookie } from "../tanstackFunctions/index.js";
|
|
9
9
|
const formatJson = (view)=>{
|
|
10
10
|
try {
|
|
11
11
|
const text = view.state.doc.toString();
|