-
Notifications
You must be signed in to change notification settings - Fork 0
Extract chatbot and timeline to plugin packages #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f897da
3f307da
d8ffdf7
0a715bf
0bf9927
86198dd
4bb512f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # @object-ui/plugin-chatbot | ||
|
|
||
| Chatbot interface plugin for Object UI. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @object-ui/plugin-chatbot | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```tsx | ||
| import { Chatbot } from '@object-ui/plugin-chatbot'; | ||
|
|
||
| function App() { | ||
| const [messages, setMessages] = useState([ | ||
| { | ||
| id: '1', | ||
| role: 'assistant', | ||
| content: 'Hello! How can I help you today?' | ||
| } | ||
| ]); | ||
|
|
||
| const handleSend = (content: string) => { | ||
| const newMessage = { | ||
| id: Date.now().toString(), | ||
| role: 'user', | ||
| content | ||
| }; | ||
| setMessages([...messages, newMessage]); | ||
| }; | ||
|
|
||
| return ( | ||
| <Chatbot | ||
| messages={messages} | ||
| onSendMessage={handleSend} | ||
| placeholder="Type your message..." | ||
| /> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| ## Schema-Driven Usage | ||
|
|
||
| This plugin automatically registers with ObjectUI's component registry when imported: | ||
|
|
||
| ```tsx | ||
| import '@object-ui/plugin-chatbot'; | ||
|
|
||
| const schema = { | ||
| component: 'chatbot', | ||
| messages: [ | ||
| { id: '1', role: 'assistant', content: 'Hello!' } | ||
| ], | ||
| placeholder: 'Type your message...', | ||
| autoResponse: true | ||
| }; | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| MIT © ObjectStack Inc. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||
| { | ||||||
| "name": "@object-ui/plugin-chatbot", | ||||||
| "version": "0.3.0", | ||||||
| "type": "module", | ||||||
| "license": "MIT", | ||||||
| "description": "Chatbot interface plugin for Object UI", | ||||||
| "homepage": "https://www.objectui.org", | ||||||
| "repository": { | ||||||
| "type": "git", | ||||||
| "url": "https://github.com/objectstack-ai/objectui.git", | ||||||
| "directory": "packages/plugin-chatbot" | ||||||
| }, | ||||||
| "bugs": { | ||||||
| "url": "https://github.com/objectstack-ai/objectui/issues" | ||||||
| }, | ||||||
| "main": "dist/index.umd.cjs", | ||||||
| "module": "dist/index.js", | ||||||
| "types": "dist/index.d.ts", | ||||||
| "exports": { | ||||||
| ".": { | ||||||
| "types": "./dist/index.d.ts", | ||||||
| "import": "./dist/index.js", | ||||||
| "require": "./dist/index.umd.cjs" | ||||||
| } | ||||||
| }, | ||||||
| "scripts": { | ||||||
| "build": "vite build", | ||||||
| "test": "vitest run", | ||||||
| "test:watch": "vitest", | ||||||
| "type-check": "tsc --noEmit", | ||||||
| "lint": "eslint ." | ||||||
| }, | ||||||
| "dependencies": { | ||||||
| "@object-ui/components": "workspace:*", | ||||||
| "@object-ui/core": "workspace:*", | ||||||
| "@object-ui/react": "workspace:*", | ||||||
| "@object-ui/types": "workspace:*", | ||||||
| "lucide-react": "^0.468.0" | ||||||
|
||||||
| "lucide-react": "^0.468.0" | |
| "lucide-react": "^0.562.0" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "dist", | ||
| "jsx": "react-jsx", | ||
| "baseUrl": ".", | ||
| "paths": { | ||
| "@/*": ["src/*"] | ||
| }, | ||
| "noEmit": false, | ||
| "declaration": true, | ||
| "composite": true, | ||
| "declarationMap": true, | ||
| "skipLibCheck": true | ||
| }, | ||
| "include": ["src"], | ||
| "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the schema-driven usage example, the key is
component: 'chatbot'but the rest of the ObjectUI schema types (e.g.ChatbotSchemainpackages/types/src/complex.ts) and other docs usetype: 'chatbot'. To avoid confusing users and to provide a working example, this snippet should usetype: 'chatbot'instead ofcomponent.