-
Notifications
You must be signed in to change notification settings - Fork 150
docs: update data extract scene cases #900
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
Conversation
Summary of ChangesHello @Yzing, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the project's documentation by replacing the generic 'data analysis' section with a focused and interactive 'data extract' guide. It introduces new documentation pages in both English and Chinese, complete with live code examples that showcase data extraction capabilities from CSV and natural language using the AVA library. Essential configuration changes were also implemented to seamlessly integrate these new documentation components within the Dumi site. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request updates the documentation by adding new scene cases for data extraction. It introduces two new demo components, one for extracting data from CSV and another from natural language. While the documentation update is valuable, I've found a critical security vulnerability in the new demo components: hardcoded API credentials. Additionally, there are some medium-severity issues related to React hook usage, typos, and redundant code that should be addressed to improve code quality and maintainability. My detailed feedback is in the comments below.
| appId: '202510APxPmo00551539', | ||
| authorization: 'TBox-c4ae8a71224e42baaafb1c01d15395a7', |
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.
Hardcoding credentials like appId and authorization is a significant security risk. These secrets will be exposed in the frontend code and committed to version control. They should be loaded from environment variables. You can add them to your .dumirc.ts file's define section to make them available as process.env variables, similar to how TEST_TOKEN is handled.
| appId: '202510APxPmo00551539', | |
| authorization: 'TBox-c4ae8a71224e42baaafb1c01d15395a7', | |
| appId: process.env.AVA_LLM_APP_ID, | |
| authorization: process.env.AVA_LLM_AUTHORIZATION, |
| appId: '202510APxPmo00551539', | ||
| authorization: 'TBox-c4ae8a71224e42baaafb1c01d15395a7', |
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.
Hardcoding credentials like appId and authorization is a significant security risk. These secrets will be exposed in the frontend code and committed to version control. They should be loaded from environment variables. You can add them to your .dumirc.ts file's define section to make them available as process.env variables, similar to how TEST_TOKEN is handled.
| appId: '202510APxPmo00551539', | |
| authorization: 'TBox-c4ae8a71224e42baaafb1c01d15395a7', | |
| appId: process.env.AVA_LLM_APP_ID, | |
| authorization: process.env.AVA_LLM_AUTHORIZATION, |
|
|
||
| const App = () => { | ||
| const [input, setInput] = useState(INPUT_DATA); | ||
| const [reslut, setResult] = useState([]); |
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.
| const result = await ava.extract(input); | ||
| setResult(result); | ||
| setLoading(false); | ||
| }, [loading]); |
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.
The dependency array for useCallback is incorrect. The callback sets the loading state, so it should not depend on loading. This creates a new function every time the loading state changes, which is inefficient and defeats the purpose of useCallback. The callback depends on input, so the dependency array should be [input]. Since the input is not editable in this demo, you could also use an empty array [].
| }, [loading]); | |
| }, [input]); |
| </Button>, | ||
| ]} | ||
| > | ||
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} onChange={(e) => setInput(e.target.value)} /> |
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.
The Input.TextArea component has the readOnly prop, which prevents users from editing its content. However, it also has an onChange handler. This handler will never be triggered, making the code confusing. Since the intent seems to be a non-editable demo, the onChange prop should be removed.
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} onChange={(e) => setInput(e.target.value)} /> | |
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} /> |
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} onChange={(e) => setInput(e.target.value)} /> | ||
| </Card> | ||
| <Card style={CARD_STYLE} title="提取结果:"> | ||
| <JsonView data={reslut} /> |
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.
|
|
||
| const App = () => { | ||
| const [input, setInput] = useState(INPUT_DATA); | ||
| const [reslut, setResult] = useState([]); |
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.
| const result = await ava.extract(input); | ||
| setResult(result); | ||
| setLoading(false); | ||
| }, [loading]); |
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.
The dependency array for useCallback is incorrect. The callback sets the loading state, so it should not depend on loading. This creates a new function every time the loading state changes, which is inefficient and defeats the purpose of useCallback. The callback depends on input, so the dependency array should be [input]. Since the input is not editable in this demo, you could also use an empty array [].
| }, [loading]); | |
| }, [input]); |
| </Button>, | ||
| ]} | ||
| > | ||
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} onChange={(e) => setInput(e.target.value)} /> |
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.
The Input.TextArea component has the readOnly prop, which prevents users from editing its content. However, it also has an onChange handler. This handler will never be triggered, making the code confusing. Since the intent seems to be a non-editable demo, the onChange prop should be removed.
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} onChange={(e) => setInput(e.target.value)} /> | |
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} /> |
| <Input.TextArea readOnly style={{ height: '300px' }} value={input} onChange={(e) => setInput(e.target.value)} /> | ||
| </Card> | ||
| <Card style={CARD_STYLE} title="提取结果:"> | ||
| <JsonView data={reslut} /> |
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v4 #900 +/- ##
=======================================
Coverage 59.37% 59.37%
=======================================
Files 77 77
Lines 2085 2085
Branches 394 394
=======================================
Hits 1238 1238
Misses 847 847
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
PR includes