Skip to content

Commit

Permalink
Your commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
zoosos committed Aug 5, 2024
1 parent 7ab4941 commit e889e36
Show file tree
Hide file tree
Showing 28 changed files with 14,982 additions and 7,396 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module.exports = {
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended'
'plugin:prettier/recommended',
'react-app'
],
settings: {
react: {
Expand All @@ -15,14 +16,14 @@ module.exports = {
},
parser: '@typescript-eslint/parser',
ignorePatterns: ['**/node_modules', '**/dist', '**/build', '**/package-lock.json'],
plugins: ['unused-imports'],
plugins: ['unused-imports', 'prettier'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': ['warn', { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }],
'no-undef': 'off',
'no-console': [process.env.CI ? 'error' : 'warn', { allow: ['warn', 'error', 'info'] }],
'prettier/prettier': 'error'
'prettier/prettier': ['error', {}, { usePrettierrc: true }]
}
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"printWidth": 120
}
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,38 @@
"lint": "eslint \"**/*.{js,jsx,ts,tsx,json,md}\"",
"lint-fix": "pnpm lint --fix",
"quick": "pretty-quick --staged",
"prepare": "husky install",
"postinstall": "husky install",
"migration:create": "pnpm typeorm migration:create"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,md}": "eslint --fix"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"devDependencies": {
"@babel/preset-env": "^7.19.4",
"@babel/preset-typescript": "7.18.6",
"@types/express": "^4.17.13",
"@typescript-eslint/typescript-estree": "^7.13.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.3.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.1",
"kill-port": "^2.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"rimraf": "^5.0.5",
"run-script-os": "^1.1.6",
"turbo": "1.10.16",
"typescript": "^5.4.5"
Expand Down
3 changes: 3 additions & 0 deletions pkg/chat-embed/.huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"gitDir": "../../.git"
}
10 changes: 7 additions & 3 deletions pkg/chat-embed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hanzo/ai-embed",
"version": "1.3.7",
"name": "@hanzo/embed",
"version": "1.3.8",
"description": "Javascript library to display flowise chatbot on your website",
"type": "module",
"main": "dist/index.js",
Expand All @@ -12,7 +12,11 @@
"lint-fix": "eslint --fix \"src/**/*.ts*\"",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"prepare": "husky install"
"prepare": "cd ../.. && husky install pkg/chat-embed/.husky",
"prepublishOnly": "npm run build"
},
"publishConfig": {
"access": "public"
},
"license": "MIT",
"dependencies": {
Expand Down
6 changes: 4 additions & 2 deletions pkg/chat-embed/src/components/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
});
setLocalStorageChatflow(props.chatflowid, chatId(), { chatHistory: messages });
};

// Define the audioRef
let audioRef: HTMLAudioElement | undefined;
// CDN link for default receive sound
Expand Down Expand Up @@ -626,7 +626,9 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
const socket = socketIOClient(props.apiHost as string);

socket.on('connect', () => {
setSocketIOClientId(socket.id);
if (socket.id) {
setSocketIOClientId(socket.id);
}
});

socket.on('start', () => {
Expand Down
2 changes: 1 addition & 1 deletion pkg/components/nodes/memory/MongoDBMemory/MongoDBMemory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const initializeMongoDB = async (nodeData: INodeData, options: ICommonObject): P
sessionId: (mongoDBChatMessageHistory as any).sessionId
})
const messages = document?.messages || []
return messages.map(mapStoredMessageToChatMessage)
return messages.map(mapStoredMessageToChatMessage) as BaseMessage[]
}

mongoDBChatMessageHistory.addMessage = async (message: BaseMessage): Promise<void> => {
Expand Down
2 changes: 1 addition & 1 deletion pkg/components/nodes/vectorstores/Milvus/Milvus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const similaritySearchVectorWithScore = async (query: number[], k: number, vecto
anns_field: vectorStore.vectorField,
topk: k.toString(),
metric_type: vectorStore.indexCreateParams.metric_type,
params: vectorStore.indexSearchParams
params: JSON.stringify(vectorStore.indexSearchParams)
},
output_fields: outputFields,
vector_type: DataType.FloatVector,
Expand Down
2 changes: 1 addition & 1 deletion pkg/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"pdfjs-dist": "^3.7.107",
"pg": "^8.11.2",
"playwright": "^1.35.0",
"puppeteer": "^20.7.1",
"puppeteer": "^22.15.0",
"pyodide": ">=0.21.0-alpha.2",
"redis": "^4.6.7",
"replicate": "^0.31.1",
Expand Down
11 changes: 5 additions & 6 deletions pkg/embed-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module.exports = {
root: true,
extends: ['custom'],
rules: {
'@next/next/no-img-element': 'off',
'@next/next/no-html-link-for-pages': 'off',
},
root: true,
rules: {
'@next/next/no-img-element': 'off',
'@next/next/no-html-link-for-pages': 'off'
}
}
27 changes: 10 additions & 17 deletions pkg/embed-react/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,41 @@
<!-- markdownlint-disable MD030 -->

# Flowise Embed React
# Hanzo Embed React

React library to display flowise chatbot on your website

![Flowise](https://github.com/FlowiseAI/FlowiseChatEmbed/blob/main/images/ChatEmbed.gif?raw=true)
![Hanzo](https://github.com/FlowiseAI/FlowiseChatEmbed/blob/main/images/ChatEmbed.gif?raw=true)

## Install

```bash
npm install @hanzo/ai-embed @hanzo/ai-embed-react
npm install @hanzo/embed @hanzo/embed-react
```

or

```bash
yarn add @hanzo/ai-embed @hanzo/ai-embed-react
yarn add @hanzo/embed @hanzo/embed-react
```

## Import

Full Page Chat

```tsx
import { FullPageChat } from "@hanzo/ai-embed-react";
import { FullPageChat } from '@hanzo/embed-react'

const App = () => {
return (
<FullPageChat
chatflowid="your-chatflow-id"
apiHost="http://localhost:3000"
/>
);
};
return <FullPageChat chatflowid='your-chatflow-id' apiHost='http://localhost:3000' />
}
```

Popup Chat

```tsx
import { BubbleChat } from "@hanzo/ai-embed-react";
import { BubbleChat } from '@hanzo/embed-react'

const App = () => {
return (
<BubbleChat chatflowid="your-chatflow-id" apiHost="http://localhost:3000" />
);
};
return <BubbleChat chatflowid='your-chatflow-id' apiHost='http://localhost:3000' />
}
```
79 changes: 41 additions & 38 deletions pkg/embed-react/package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
{
"name": "@hanzo/ai-embed-react",
"version": "1.0.2",
"description": "React library to display flowise chatbot on your website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"dev": "rollup --watch --config rollup.config.js",
"build": "rollup --config rollup.config.js",
"lint": "eslint --fix \"src/**/*.ts*\""
},
"keywords": [],
"license": "MIT",
"dependencies": {
"@ladle/react": "2.5.1"
},
"devDependencies": {
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.21.4",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-terser": "0.4.0",
"@rollup/plugin-typescript": "11.0.0",
"@types/node": "18.15.11",
"@types/react": "18.0.32",
"eslint": "8.37.0",
"@hanzo/ai-embed": "*",
"react": "18.2.0",
"rollup": "3.20.2",
"rollup-plugin-typescript-paths": "1.4.0",
"tslib": "2.5.0",
"tsx": "3.12.6",
"typescript": "5.0.3"
},
"peerDependencies": {
"@hanzo/ai-embed": "*",
"react": "18.x"
}
"name": "@hanzo/embed-react",
"version": "1.0.2",
"description": "React library to display flowise chatbot on your website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"dev": "rollup --watch --config rollup.config.js",
"build": "rollup --config rollup.config.js",
"lint": "eslint --fix \"src/**/*.ts*\""
},
"keywords": [],
"license": "MIT",
"dependencies": {
"@ladle/react": "2.5.1"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.21.4",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-terser": "0.4.0",
"@rollup/plugin-typescript": "11.0.0",
"@types/node": "18.15.11",
"@types/react": "18.0.32",
"eslint": "8.37.0",
"@hanzo/embed": "*",
"react": "18.2.0",
"rollup": "3.20.2",
"rollup-plugin-typescript-paths": "1.4.0",
"tslib": "2.5.0",
"tsx": "3.12.6",
"typescript": "5.0.3"
},
"peerDependencies": {
"@hanzo/embed": "*",
"react": "18.x"
}
}
1 change: 1 addition & 0 deletions pkg/react-json-view/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile;
36 changes: 22 additions & 14 deletions pkg/react-json-view/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{
"tabWidth": 4,
"printWidth": 80,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"parser": "babel",
"semi": true,
"requirePragma": false,
"proseWrap": "preserve",
"arrowParens": "avoid",
"eslintIntegration": false,
"endOfLine": "auto"
}
"tabWidth": 4,
"printWidth": 80,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"parser": "babel",
"semi": true,
"requirePragma": false,
"proseWrap": "preserve",
"arrowParens": "avoid",
"eslintIntegration": false,
"endOfLine": "auto",
"overrides": [
{
"files": "*.json",
"options": {
"parser": "json"
}
}
]
}
5 changes: 2 additions & 3 deletions pkg/react-json-view/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM node:14.15.4-buster-slim
MAINTAINER mac <mac.gainor@gmail.com>

LABEL maintainer="woo <woo@lux.network>"
# install the node modules at container build time
RUN mkdir -p /react
ADD package.json /react/package.json
RUN cd /react && npm install --save-dev --silent

# Now add our project code
## Now add our project code
ADD . /react
WORKDIR /react

Expand Down
Loading

0 comments on commit e889e36

Please sign in to comment.