@makemore/agent-frontend 2.7.2 → 2.8.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/dist/chat-widget-vanilla.js.bak +1264 -0
- package/dist/chat-widget.cjs.js +590 -0
- package/dist/chat-widget.css +1 -0
- package/dist/chat-widget.esm.js +590 -0
- package/dist/chat-widget.js +34 -34
- package/dist/chat-widget.js.map +7 -0
- package/dist/react.cjs.js +590 -0
- package/dist/react.esm.js +590 -0
- package/package.json +34 -9
- package/src/react.js +78 -0
package/package.json
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makemore/agent-frontend",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "A lightweight chat widget for AI agents
|
|
3
|
+
"version": "2.8.1",
|
|
4
|
+
"description": "A lightweight chat widget for AI agents. Use as an embeddable script tag or import directly into React/Preact projects.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/chat-widget.js",
|
|
7
|
-
"module": "
|
|
6
|
+
"main": "dist/chat-widget.cjs.js",
|
|
7
|
+
"module": "dist/chat-widget.esm.js",
|
|
8
|
+
"browser": "dist/chat-widget.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/chat-widget.esm.js",
|
|
12
|
+
"require": "./dist/chat-widget.cjs.js",
|
|
13
|
+
"browser": "./dist/chat-widget.js"
|
|
14
|
+
},
|
|
15
|
+
"./react": {
|
|
16
|
+
"import": "./dist/react.esm.js",
|
|
17
|
+
"require": "./dist/react.cjs.js"
|
|
18
|
+
},
|
|
19
|
+
"./embed": "./dist/chat-widget.js",
|
|
20
|
+
"./css": "./dist/chat-widget.css"
|
|
21
|
+
},
|
|
8
22
|
"files": [
|
|
9
|
-
"dist/
|
|
10
|
-
"dist/chat-widget.css",
|
|
11
|
-
"dist/chat-widget-markdown.js",
|
|
23
|
+
"dist/",
|
|
12
24
|
"src/",
|
|
13
25
|
"README.md",
|
|
14
26
|
"LICENSE"
|
|
15
27
|
],
|
|
16
28
|
"scripts": {
|
|
17
|
-
"build": "
|
|
18
|
-
"build:dev": "
|
|
29
|
+
"build": "node build.js",
|
|
30
|
+
"build:dev": "node build.js --dev",
|
|
31
|
+
"build:embed": "esbuild src/index.js --bundle --minify --format=iife --global-name=ChatWidgetModule --outfile=dist/chat-widget.js",
|
|
19
32
|
"watch": "node watch.js",
|
|
20
33
|
"copy": "cp -f dist/chat-widget.js ../django_agent_studio/static/agent-frontend/chat-widget.js 2>/dev/null || true && echo 'Copied to django_agent_studio'",
|
|
21
34
|
"prepublishOnly": "npm run build",
|
|
@@ -52,6 +65,18 @@
|
|
|
52
65
|
"htm": "^3.1.1",
|
|
53
66
|
"preact": "^10.19.3"
|
|
54
67
|
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"react": ">=16.8.0",
|
|
70
|
+
"react-dom": ">=16.8.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"react": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"react-dom": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
55
80
|
"devDependencies": {
|
|
56
81
|
"esbuild": "^0.20.0"
|
|
57
82
|
}
|
package/src/react.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React-compatible exports for @makemore/agent-frontend
|
|
3
|
+
*
|
|
4
|
+
* This module provides React-compatible components and hooks.
|
|
5
|
+
* It uses preact/compat under the hood, which provides full React API compatibility.
|
|
6
|
+
*
|
|
7
|
+
* Usage in React projects:
|
|
8
|
+
*
|
|
9
|
+
* import { ChatWidget, useChat, useModels } from '@makemore/agent-frontend/react';
|
|
10
|
+
*
|
|
11
|
+
* function App() {
|
|
12
|
+
* return (
|
|
13
|
+
* <ChatWidget
|
|
14
|
+
* config={{
|
|
15
|
+
* backendUrl: 'https://api.example.com',
|
|
16
|
+
* agentKey: 'my-agent',
|
|
17
|
+
* }}
|
|
18
|
+
* />
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* Or use hooks directly for custom UI:
|
|
23
|
+
*
|
|
24
|
+
* import { useChat, createApiClient, mergeConfig } from '@makemore/agent-frontend/react';
|
|
25
|
+
*
|
|
26
|
+
* function CustomChat() {
|
|
27
|
+
* const config = mergeConfig({ backendUrl: '...', agentKey: '...' });
|
|
28
|
+
* const api = createApiClient(config, () => ({}), () => {});
|
|
29
|
+
* const chat = useChat(config, api, null);
|
|
30
|
+
*
|
|
31
|
+
* return (
|
|
32
|
+
* <div>
|
|
33
|
+
* {chat.messages.map(msg => <div key={msg.id}>{msg.content}</div>)}
|
|
34
|
+
* <button onClick={() => chat.sendMessage('Hello!')}>Send</button>
|
|
35
|
+
* </div>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
// Components
|
|
41
|
+
export { ChatWidget } from './components/ChatWidget.js';
|
|
42
|
+
export { Header } from './components/Header.js';
|
|
43
|
+
export { MessageList } from './components/MessageList.js';
|
|
44
|
+
export { Message } from './components/Message.js';
|
|
45
|
+
export { InputForm } from './components/InputForm.js';
|
|
46
|
+
export { Sidebar } from './components/Sidebar.js';
|
|
47
|
+
export { ModelSelector } from './components/ModelSelector.js';
|
|
48
|
+
export { TaskList } from './components/TaskList.js';
|
|
49
|
+
|
|
50
|
+
// Hooks
|
|
51
|
+
export { useChat } from './hooks/useChat.js';
|
|
52
|
+
export { useModels } from './hooks/useModels.js';
|
|
53
|
+
export { useTasks } from './hooks/useTasks.js';
|
|
54
|
+
|
|
55
|
+
// Utilities
|
|
56
|
+
export { createApiClient } from './utils/api.js';
|
|
57
|
+
export { mergeConfig, DEFAULT_CONFIG } from './utils/config.js';
|
|
58
|
+
export {
|
|
59
|
+
generateId,
|
|
60
|
+
createStorage,
|
|
61
|
+
camelToSnake,
|
|
62
|
+
snakeToCamel,
|
|
63
|
+
keysToCamel,
|
|
64
|
+
keysToSnake,
|
|
65
|
+
parseMarkdown,
|
|
66
|
+
formatDate,
|
|
67
|
+
formatFileSize,
|
|
68
|
+
getFileTypeIcon,
|
|
69
|
+
getCSRFToken,
|
|
70
|
+
} from './utils/helpers.js';
|
|
71
|
+
|
|
72
|
+
// Re-export the imperative API for backwards compatibility
|
|
73
|
+
export { ChatWidget as ChatWidgetAPI } from './index.js';
|
|
74
|
+
|
|
75
|
+
// Default export is the main ChatWidget component
|
|
76
|
+
import { ChatWidget as ChatWidgetComponent } from './components/ChatWidget.js';
|
|
77
|
+
export default ChatWidgetComponent;
|
|
78
|
+
|