reachat 0.0.1 → 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.
Files changed (50) hide show
  1. package/README.md +86 -39
  2. package/dist/Chat.d.ts +58 -0
  3. package/dist/ChatContext.d.ts +18 -0
  4. package/dist/ChatInput.d.ts +42 -0
  5. package/dist/Markdown/CodeHighlighter.d.ts +25 -0
  6. package/dist/Markdown/Markdown.d.ts +11 -0
  7. package/dist/Markdown/Table.d.ts +5 -0
  8. package/dist/Markdown/index.d.ts +5 -0
  9. package/dist/Markdown/plugins/index.d.ts +1 -0
  10. package/dist/Markdown/plugins/remarkCve.d.ts +1 -0
  11. package/dist/Markdown/themes/dark.d.ts +501 -0
  12. package/dist/Markdown/themes/index.d.ts +2 -0
  13. package/dist/Markdown/themes/light.d.ts +499 -0
  14. package/dist/SessionMessages/MessageActions.d.ts +45 -0
  15. package/dist/SessionMessages/MessageFile.d.ts +14 -0
  16. package/dist/SessionMessages/MessageFiles.d.ts +11 -0
  17. package/dist/SessionMessages/MessageQuestion.d.ts +9 -0
  18. package/dist/SessionMessages/MessageResponse.d.ts +13 -0
  19. package/dist/SessionMessages/MessageSource.d.ts +10 -0
  20. package/dist/SessionMessages/MessageSources.d.ts +11 -0
  21. package/dist/SessionMessages/SessionEmpty.d.ts +6 -0
  22. package/dist/SessionMessages/SessionMessage.d.ts +15 -0
  23. package/dist/SessionMessages/SessionMessagePanel.d.ts +3 -0
  24. package/dist/SessionMessages/SessionMessages.d.ts +23 -0
  25. package/dist/SessionMessages/SessionMessagesHeader.d.ts +3 -0
  26. package/dist/SessionMessages/index.d.ts +12 -0
  27. package/dist/SessionsList/NewSessionButton.d.ts +10 -0
  28. package/dist/SessionsList/SessionGroups.d.ts +10 -0
  29. package/dist/SessionsList/SessionListItem.d.ts +22 -0
  30. package/dist/SessionsList/SessionsGroup.d.ts +10 -0
  31. package/dist/SessionsList/SessionsList.d.ts +3 -0
  32. package/dist/SessionsList/index.d.ts +5 -0
  33. package/dist/docs.json +1478 -0
  34. package/dist/index.d.ts +4 -5
  35. package/dist/index.js +1866 -3211
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.umd.cjs +1868 -3209
  38. package/dist/index.umd.cjs.map +1 -1
  39. package/dist/theme.d.ts +77 -1
  40. package/dist/types.d.ts +71 -17
  41. package/dist/utils.d.ts +7 -0
  42. package/dist/utils.spec.d.ts +1 -0
  43. package/package.json +38 -23
  44. package/dist/SessionInput.d.ts +0 -22
  45. package/dist/SessionListItem.d.ts +0 -11
  46. package/dist/SessionMessage.d.ts +0 -10
  47. package/dist/SessionMessages.d.ts +0 -9
  48. package/dist/Sessions.d.ts +0 -48
  49. package/dist/SessionsList.d.ts +0 -11
  50. package/dist/useLlm.d.ts +0 -3
package/dist/theme.d.ts CHANGED
@@ -1,3 +1,79 @@
1
- export interface SessionsTheme {
1
+ export interface ChatTheme {
2
2
  base: string;
3
+ console: string;
4
+ companion: string;
5
+ empty: string;
6
+ sessions: {
7
+ base: string;
8
+ console: string;
9
+ companion: string;
10
+ create: string;
11
+ group: string;
12
+ session: {
13
+ base: string;
14
+ active: string;
15
+ delete: string;
16
+ };
17
+ };
18
+ messages: {
19
+ base: string;
20
+ console: string;
21
+ companion: string;
22
+ back: string;
23
+ inner: string;
24
+ title: string;
25
+ date: string;
26
+ content: string;
27
+ header: string;
28
+ showMore: string;
29
+ message: {
30
+ base: string;
31
+ question: string;
32
+ response: string;
33
+ cursor: string;
34
+ files: {
35
+ base: string;
36
+ file: {
37
+ base: string;
38
+ name: string;
39
+ };
40
+ };
41
+ sources: {
42
+ base: string;
43
+ source: {
44
+ base: string;
45
+ image: string;
46
+ title: string;
47
+ url: string;
48
+ };
49
+ };
50
+ markdown: {
51
+ p: string;
52
+ a: string;
53
+ table: string;
54
+ th: string;
55
+ td: string;
56
+ code: string;
57
+ li: string;
58
+ ul: string;
59
+ ol: string;
60
+ copy: string;
61
+ };
62
+ footer: {
63
+ base: string;
64
+ copy: string;
65
+ upvote: string;
66
+ downvote: string;
67
+ refresh: string;
68
+ };
69
+ };
70
+ };
71
+ input: {
72
+ base: string;
73
+ upload: string;
74
+ input: string;
75
+ send: string;
76
+ stop: string;
77
+ };
3
78
  }
79
+ export declare const chatTheme: ChatTheme;
package/dist/types.d.ts CHANGED
@@ -1,30 +1,84 @@
1
- export interface User {
2
- id: string;
3
- name: string;
4
- avatarUrl?: string;
5
- }
6
1
  export interface ConversationSource {
7
- id: string;
8
- url: string;
9
- title: string;
2
+ /**
3
+ * URL of the source, if applicable
4
+ */
5
+ url?: string;
6
+ /**
7
+ * Title or description of the source
8
+ */
9
+ title?: string;
10
+ /**
11
+ * Image URL of the source, if applicable.
12
+ */
13
+ image?: string;
14
+ }
15
+ export interface ConversationFile {
16
+ /**
17
+ * Name of the file
18
+ */
19
+ name: string;
20
+ /**
21
+ * Type of the file
22
+ */
23
+ type?: string;
24
+ /**
25
+ * Size of the file
26
+ */
27
+ size?: number;
28
+ /**
29
+ * URL of the file
30
+ */
31
+ url?: string;
10
32
  }
11
33
  export interface Conversation {
34
+ /**
35
+ * Unique identifier for the conversation
36
+ */
12
37
  id: string;
38
+ /**
39
+ * Date and time when the conversation was created
40
+ */
13
41
  createdAt: Date;
14
- updatedAt: Date;
42
+ /**
43
+ * Date and time when the conversation was last updated
44
+ */
45
+ updatedAt?: Date;
46
+ /**
47
+ * The user's question or input that initiated the conversation
48
+ */
15
49
  question: string;
50
+ /**
51
+ * The AI's response to the user's question
52
+ */
16
53
  response?: string;
54
+ /**
55
+ * Array of sources referenced in the conversation
56
+ */
17
57
  sources?: ConversationSource[];
18
- status?: 'sent' | 'received' | 'read';
19
- user?: User;
58
+ /**
59
+ * Array of file paths or identifiers associated with the conversation
60
+ */
61
+ files?: ConversationFile[];
20
62
  }
21
63
  export interface Session {
64
+ /**
65
+ * Unique identifier for the session
66
+ */
22
67
  id: string;
23
- title: string;
24
- createdAt: Date;
25
- updatedAt: Date;
68
+ /**
69
+ * Title of the session
70
+ */
71
+ title?: string;
72
+ /**
73
+ * Date and time when the session was created
74
+ */
75
+ createdAt?: Date;
76
+ /**
77
+ * Date and time when the session was last updated
78
+ */
79
+ updatedAt?: Date;
80
+ /**
81
+ * Array of conversations within this session
82
+ */
26
83
  conversations: Conversation[];
27
84
  }
28
- export interface ResponseTransformer {
29
- (response: string, next: (transformedResponse: string) => string): string;
30
- }
@@ -0,0 +1,7 @@
1
+ import { Session } from './types';
2
+
3
+ export interface GroupedSessions {
4
+ heading: string;
5
+ sessions: Session[];
6
+ }
7
+ export declare function groupSessionsByDate(sessions: Session[]): GroupedSessions[];
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "reachat",
3
- "version": "0.0.1",
3
+ "version": "1.0.1",
4
4
  "description": "Chat UI for Building LLMs",
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",
7
- "build": "vite build --mode library",
7
+ "build": "npm run build:js && npm run build:docs",
8
+ "build:js": "vite build --mode library",
9
+ "build:docs": "node scripts/docs.js",
8
10
  "lint": "eslint --ext js,ts,tsx",
9
11
  "lint:fix": "eslint --ext js,ts,tsx --fix src",
10
12
  "lint:prettier": "prettier --loglevel warn --write 'src/**/*.{ts,tsx,js,jsx}'",
@@ -29,26 +31,39 @@
29
31
  "require": "./dist/index.umd.cjs",
30
32
  "types": "./dist/index.d.ts"
31
33
  },
34
+ "./docs.json": "./dist/docs.json",
32
35
  "./index.css": "./dist/index.css"
33
36
  },
34
37
  "browser": "dist/index.js",
35
38
  "typings": "dist/index.d.ts",
36
39
  "dependencies": {
37
- "reablocks": "^8.4.1",
38
- "react-textarea-autosize": "^8.5.3",
39
- "framer-motion": "^10.16.16"
40
+ "@radix-ui/react-slot": "^1.1.0",
41
+ "date-fns": "^3.6.0",
42
+ "framer-motion": "^10.16.16",
43
+ "mdast-util-find-and-replace": "^3.0.1",
44
+ "reablocks": "^8.4.0",
45
+ "react-cool-dimensions": "^3.0.1",
46
+ "react-markdown": "^9.0.1",
47
+ "react-syntax-highlighter": "^15.5.0",
48
+ "reakeys": "^2.0.3",
49
+ "remark-gfm": "^4.0.0",
50
+ "remark-youtube": "^1.3.2"
51
+ },
52
+ "peerDependencies": {
53
+ "react": ">=18",
54
+ "react-dom": ">=18"
40
55
  },
41
56
  "devDependencies": {
42
- "@storybook/addon-docs": "^8.1.1",
43
- "@storybook/addon-essentials": "^8.1.1",
44
- "@storybook/addon-mdx-gfm": "^8.1.1",
45
- "@storybook/addon-storysource": "^8.1.1",
46
- "@storybook/addon-themes": "^8.1.1",
47
- "@storybook/manager-api": "^8.1.1",
48
- "@storybook/preview-api": "^8.1.1",
49
- "@storybook/react": "^8.1.1",
50
- "@storybook/react-vite": "^8.1.1",
51
- "@storybook/theming": "^8.1.1",
57
+ "@storybook/addon-docs": "^8.2.6",
58
+ "@storybook/addon-essentials": "^8.2.6",
59
+ "@storybook/addon-mdx-gfm": "^8.2.6",
60
+ "@storybook/addon-storysource": "^8.2.6",
61
+ "@storybook/addon-themes": "^8.2.6",
62
+ "@storybook/manager-api": "^8.2.6",
63
+ "@storybook/preview-api": "^8.2.6",
64
+ "@storybook/react": "^8.2.6",
65
+ "@storybook/react-vite": "^8.2.6",
66
+ "@storybook/theming": "^8.2.6",
52
67
  "@types/classnames": "^2.3.1",
53
68
  "@types/react": "^18.2.61",
54
69
  "@types/react-dom": "^18.2.19",
@@ -67,24 +82,23 @@
67
82
  "husky": "^9.0.11",
68
83
  "jsdom": "^24.0.0",
69
84
  "lint-staged": "^15.2.2",
85
+ "openai": "^4.53.0",
86
+ "postcss": "^8.4.39",
70
87
  "postcss-nested": "^6.0.1",
71
88
  "postcss-preset-env": "^9.5.2",
72
89
  "prettier": "^3.2.5",
73
- "react": "^18.0.0",
90
+ "react": "^18.3.1",
74
91
  "react-docgen-typescript": "^2.2.2",
75
- "react-dom": "^18.0.0",
76
- "react-hook-form": "^7.51.1",
92
+ "react-dom": "^18.3.1",
77
93
  "rollup-plugin-peer-deps-external": "2.2.4",
78
- "storybook": "^8.1.1",
79
- "tailwindcss": "^3.4.1",
94
+ "storybook": "^8.2.6",
95
+ "tailwindcss": "^3.4.6",
80
96
  "tw-colors": "^3.3.1",
81
97
  "typescript": "^4.9.5",
82
- "typescript-rewrite-paths": "^1.3.1",
83
98
  "vite": "^5.2.2",
84
99
  "vite-plugin-checker": "^0.6.4",
85
100
  "vite-plugin-css-injected-by-js": "^3.5.0",
86
101
  "vite-plugin-dts": "^3.7.3",
87
- "vite-plugin-static-copy": "^1.0.4",
88
102
  "vite-plugin-svgr": "^4.2.0",
89
103
  "vite-tsconfig-paths": "^4.3.2",
90
104
  "vitest": "^1.4.0"
@@ -107,5 +121,6 @@
107
121
  "hooks": {
108
122
  "pre-commit": "lint-staged"
109
123
  }
110
- }
124
+ },
125
+ "packageManager": "pnpm@9.5.0+sha1.8c155dc114e1689d18937974f6571e0ceee66f1d"
111
126
  }
@@ -1,22 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- interface SessionInputProps {
4
- /**
5
- * Indicates whether the sessions are currently loading.
6
- */
7
- isLoading?: boolean;
8
- /**
9
- * Placeholder text for the input field.
10
- */
11
- inputPlaceholder?: string;
12
- /**
13
- * Callback function to handle sending a new message.
14
- */
15
- onSendMessage?: (message: string) => void;
16
- /**
17
- * Callback function to handle stopping the current action.
18
- */
19
- onStopMessage?: () => void;
20
- }
21
- export declare const SessionInput: FC<SessionInputProps>;
22
- export {};
@@ -1,11 +0,0 @@
1
- import { FC } from 'react';
2
- import { Session } from './types';
3
-
4
- interface SessionListItemProps {
5
- session: Session;
6
- isActive: boolean;
7
- onSelectSession?: (sessionId: string) => void;
8
- onDeleteSession?: (sessionId: string) => void;
9
- }
10
- export declare const SessionListItem: FC<SessionListItemProps>;
11
- export {};
@@ -1,10 +0,0 @@
1
- import { FC } from 'react';
2
- import { ResponseTransformer } from './types';
3
-
4
- interface SessionMessageProps {
5
- question: string;
6
- response: string;
7
- responseTransformers?: ResponseTransformer[];
8
- }
9
- export declare const SessionMessage: FC<SessionMessageProps>;
10
- export {};
@@ -1,9 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ResponseTransformer, Conversation } from './types';
3
-
4
- interface SessionMessagesProps {
5
- conversations: Conversation[];
6
- responseTransformers?: ResponseTransformer[];
7
- }
8
- export declare const SessionMessages: React.FC<SessionMessagesProps>;
9
- export {};
@@ -1,48 +0,0 @@
1
- import { FC } from 'react';
2
- import { ResponseTransformer, Session } from './types';
3
-
4
- export interface SessionsProps {
5
- /**
6
- * The type of prompt to display. Companion prompts are smaller and are
7
- * meant to be displayed alongside other content. Full prompts are larger
8
- * and are meant to be displayed on their own.
9
- */
10
- viewType: 'companion' | 'full';
11
- /**
12
- * The list of sessions to display.
13
- */
14
- sessions: Session[];
15
- /**
16
- * The ID of the currently active session.
17
- */
18
- activeSessionId?: string;
19
- /**
20
- * Indicates whether the sessions are currently loading.
21
- */
22
- isLoading?: boolean;
23
- /**
24
- * Placeholder text for the input field.
25
- */
26
- inputPlaceholder?: string;
27
- /**
28
- * Array of transformer functions to apply to the response.
29
- */
30
- responseTransformers?: ResponseTransformer[];
31
- /**
32
- * Callback function to handle when a session is selected.
33
- */
34
- onSelectSession?: (sessionId: string) => void;
35
- /**
36
- * Callback function to handle when a session is deleted.
37
- */
38
- onDeleteSession?: (sessionId: string) => void;
39
- /**
40
- * Callback function to handle sending a new message.
41
- */
42
- onSendMessage?: (message: string) => void;
43
- /**
44
- * Callback function to handle stopping the current action.
45
- */
46
- onStopMessage?: () => void;
47
- }
48
- export declare const Sessions: FC<SessionsProps>;
@@ -1,11 +0,0 @@
1
- import { FC } from 'react';
2
- import { Session } from './types';
3
-
4
- interface SessionsListProps {
5
- sessions: Session[];
6
- activeSessionId?: string;
7
- onSelectSession?: (sessionId: string) => void;
8
- onDeleteSession?: (sessionId: string) => void;
9
- }
10
- export declare const SessionsList: FC<SessionsListProps>;
11
- export {};
package/dist/useLlm.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export interface LlmOptions {
2
- }
3
- export declare const useLlm: (options: LlmOptions) => void;