-
Notifications
You must be signed in to change notification settings - Fork 0
add new chat-widget component #56
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules | ||
.yalc | ||
yalc.lock | ||
|
||
/.cache | ||
/build | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,35 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { GWChatWidget, GWChatWidgetProps } from "gooey-web-widget"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export default function GooeyChatWidget({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
state, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onChange, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
...rest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}: GWChatWidgetProps & { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
state: Record<string, any>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onChange: (value: string) => void; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const handleSend = (message: string) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Handle the send event here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log("Message sent:", message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// You can also call onChange if needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onChange(message); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+12
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove console.log statement in production code. Console statements should be removed from production code as they can impact performance and may leak sensitive information. const handleSend = (message: string) => {
// Handle the send event here
- console.log("Message sent:", message);
// You can also call onChange if needed
onChange(message);
}; 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const handleClear = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Handle the clear event here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log("Chat cleared"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// You can also call onChange if needed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// onChange(""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+19
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness: The 📝 Committable Code Suggestion
Suggested change
Comment on lines
+12
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security: The component contains 📝 Committable Code Suggestion
Suggested change
Comment on lines
+19
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Resolve commented-out code and remove console.log. The handler contains a commented-out const handleClear = () => {
// Handle the clear event here
- console.log("Chat cleared");
// You can also call onChange if needed
- // onChange("");
+ onChange(""); // Uncomment if you need to notify parent component of clearing
}; 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="h-100"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<GWChatWidget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...rest} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onSend={handleSend} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
onNewConversation={handleClear} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||||||
{ | ||||||||||
"name": "gooey-gui", | ||||||||||
"version": "0.5.3", | ||||||||||
"version": "0.5.4", | ||||||||||
"sideEffects": false, | ||||||||||
"scripts": { | ||||||||||
"build": "remix build", | ||||||||||
|
@@ -44,6 +44,7 @@ | |||||||||
"@uppy/webcam": "^3.3.1", | ||||||||||
"@uppy/xhr-upload": "^3.2.0", | ||||||||||
"firebase-admin": "^11.9.0", | ||||||||||
"gooey-web-widget": "file:.yalc/gooey-web-widget", | ||||||||||
"html-react-parser": "^4.0.0", | ||||||||||
"isbot": "^3.6.8", | ||||||||||
"jshint": "^2.13.6", | ||||||||||
|
@@ -53,8 +54,8 @@ | |||||||||
"nprogress": "^0.2.0", | ||||||||||
"plotly.js": "^2.27.1", | ||||||||||
"puppeteer": "^22.14.0", | ||||||||||
"react": "^17.0.2", | ||||||||||
"react-dom": "^17.0.2", | ||||||||||
"react": "^18.2.0", | ||||||||||
"react-dom": "^18.2.0", | ||||||||||
Comment on lines
+57
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. React version upgrade requires type definition updates React and ReactDOM have been upgraded from v17 to v18.2.0, but the type definitions in devDependencies still reference v17 (lines 77-78). Update the TypeScript type definitions to match the React version: - "@types/react": "^17.0.2",
- "@types/react-dom": "^17.0.2",
+ "@types/react": "^18.2.0",
+ "@types/react-dom": "^18.2.0", 📝 Committable suggestion
Suggested change
|
||||||||||
"react-plotly.js": "^2.6.0", | ||||||||||
"react-select": "^5.7.3", | ||||||||||
"react-syntax-highlighter": "^15.5.0", | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -922,3 +922,17 @@ def tooltip( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tooltip.mount() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return core.NestingCtx(tooltip) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
def gooey_chat_widget( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
messages, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**props, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return core.RenderTreeNode( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name="gw-chat-widget", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
props=dict( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
messages=messages, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
config=config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
**props, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
).mount() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+926
to
+938
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctness: The 📝 Committable Code Suggestion
Suggested change
|
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.
Correctness: The
state
prop is declared but never used in the component, which creates unnecessary props and could lead to confusion for developers using this component.📝 Committable Code Suggestion