diff --git a/assistant/docs/index.md b/assistant/docs/index.md index c5adb1ae..b662e246 100644 --- a/assistant/docs/index.md +++ b/assistant/docs/index.md @@ -28,7 +28,7 @@ $ yarn run doctor ``` -## How to integrate PertercatLUI by UMD way? +## How to integrate PeterCatLUI by UMD way? Step 1, externalize the following dependencies for your project **if you already used them in your project**: diff --git a/assistant/package.json b/assistant/package.json index 952b86c3..1a2d671d 100644 --- a/assistant/package.json +++ b/assistant/package.json @@ -1,11 +1,12 @@ { "name": "@petercatai/assistant", - "version": "1.0.22", + "version": "2.0.7", "description": "PeterCat Assistant Application", - "module": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", - "style": "dist/esm/style.css", - "browser": "dist/umd/assistant.min.js", + "repository": "https://github.com/petercat-ai/petercat.git", + "license": "MIT", + "sideEffects": [ + "**/*.css" + ], "exports": { ".": { "import": "./dist/esm/index.js" @@ -14,25 +15,24 @@ "import": "./dist/esm/style.css" } }, + "module": "dist/esm/index.js", + "browser": "dist/umd/assistant.min.js", + "types": "dist/esm/index.d.ts", + "style": "dist/esm/style.css", "scripts": { - "start": "npm run dev", - "dev": "dumi dev", - "build:css": "tailwindcss -i tailwind.css -o ./src/style.css", "build": "npm run build:css && cp ./src/style.css ./.dumi/tmp/style.css && father build", + "build:css": "tailwindcss -i tailwind.css -o ./src/style.css", "build:watch": "father dev", + "dev": "dumi dev", "docs:build": "dumi build", - "prepare": "dumi setup", "doctor": "father doctor", "lint": "npm run lint:es && npm run lint:css", "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"", "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"", - "prepublishOnly": "father doctor && npm run build" + "prepare": "dumi setup", + "prepublishOnly": "father doctor && npm run build", + "start": "npm run dev" }, - "authors": [], - "license": "MIT", - "sideEffects": [ - "**/*.css" - ], "commitlint": { "extends": [ "@commitlint/config-conventional" @@ -55,17 +55,10 @@ "prettier --parser=typescript --write" ] }, - "publishConfig": { - "access": "public" - }, - "peerDependencies": { - "react": ">=16.9.0 <19.0.0", - "react-dom": ">=16.9.0 <19.0.0" - }, "dependencies": { "@ant-design/icons": "^5.3.5", - "@ant-design/pro-chat": "^1.9.0", "@ant-design/pro-editor": "^1.1.1", + "@ant-design/x": "^1.0.0", "@babel/runtime": "^7.18.0", "antd": "^5.15.3", "antd-style": "^3.6.1", @@ -81,7 +74,7 @@ "devDependencies": { "@commitlint/cli": "^17.1.2", "@commitlint/config-conventional": "^17.1.0", - "@types/lodash": "^4.14.202", + "@types/lodash": "^4.17.13", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "@umijs/lint": "^4.0.0", @@ -97,5 +90,12 @@ "react-dom": "^18.0.0", "stylelint": "^14.9.1" }, - "repository": "https://github.com/petercat-ai/petercat.git" + "peerDependencies": { + "react": ">=16.9.0 <19.0.0", + "react-dom": ">=16.9.0 <19.0.0" + }, + "publishConfig": { + "access": "public" + }, + "authors": [] } diff --git a/assistant/src/Assistant/index.md b/assistant/src/Assistant/index.md index a807e476..f59dc15c 100644 --- a/assistant/src/Assistant/index.md +++ b/assistant/src/Assistant/index.md @@ -31,7 +31,6 @@ export default () => { apiUrl='/api/chat/stream_builder' token='0553365a-edb1-435c-b69c-4c645290b86e' clearMessage={true} - apiUr /> ); @@ -53,4 +52,4 @@ export default () => { | `disabled` | `boolean` | `false` | 是否禁用聊天输入区域,禁用后用户无法输入消息。 | | `disabledPlaceholder` | `string` | `undefined` | 当聊天输入区域被禁用时显示的占位符文本。 | | `getToolsResult` | `(response: any) => void` | `undefined` | 用于接收工具处理结果的回调函数。 | - +| `bottom` | `number` | `120` | 聊天助手距离底部的距离,单位为像素。 | \ No newline at end of file diff --git a/assistant/src/Assistant/index.tsx b/assistant/src/Assistant/index.tsx index a97d3f73..919c25f4 100644 --- a/assistant/src/Assistant/index.tsx +++ b/assistant/src/Assistant/index.tsx @@ -10,12 +10,19 @@ export interface AssistantProps extends ChatProps { showBubble: boolean; isVisible: boolean; onClose?: () => void; + bottom?: number; } const Assistant = (props: AssistantProps) => { - const { showBubble = true, isVisible, onClose, drawerWidth = 500 } = props; + const { + showBubble = true, + isVisible, + onClose, + drawerWidth = 500, + bottom = 120, + } = props; const [chatVisible, setChatVisible] = useState(isVisible); - const [position, setPosition] = useState({ bottom: 120 }); + const [position, setPosition] = useState({ bottom: bottom }); const toggleDrawer = () => { setChatVisible(!chatVisible); diff --git a/assistant/src/Chat/components/InputAreaRender.tsx b/assistant/src/Chat/components/InputAreaRender.tsx index 20cc9428..3de5bd9f 100644 --- a/assistant/src/Chat/components/InputAreaRender.tsx +++ b/assistant/src/Chat/components/InputAreaRender.tsx @@ -157,7 +157,7 @@ const InputAreaRender = (props: { return (