-
Notifications
You must be signed in to change notification settings - Fork 20k
fix(web): enable JSON_OBJECT type support in console UI #30412
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
fix(web): enable JSON_OBJECT type support in console UI #30412
Conversation
Summary of ChangesHello @QuantumGhost, 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 addresses a previous limitation where the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 successfully enables JSON_OBJECT type support in the UI by removing feature flags and adjusting JSON schema handling. The changes are generally well-implemented. However, I've identified a couple of areas for improvement in web/app/components/app/configuration/config-var/config-modal/index.tsx. There's a high-severity issue regarding the unconditional normalization of json_schema, which could lead to incorrect data being saved for non-JSON variable types. Additionally, there's a minor redundancy in a conditional check that could be simplified to improve code clarity.
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.
Pull request overview
This PR enables JSON_OBJECT type support in the console UI by removing the isSupportJSON feature flag and adjusting how JSON Schema is edited. Previously, the implementation auto-wrapped user properties in a top-level object structure; now it expects users to provide the complete JSON Schema including the required type: "object" field, with validation to ensure compliance.
Key Changes:
- Removed
isSupportJSONfeature flag to enable JSON_OBJECT option in non-basic app modes - Changed JSON Schema editing to expect full schema format instead of just properties
- Added validation for JSON Schema to ensure it's valid JSON with
type: "object"
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
web/app/components/app/configuration/config-var/config-modal/index.tsx |
Removed feature flag, updated JSON Schema handling logic, added validation for JSON Schema format |
web/app/components/app/configuration/config-var/config-modal/config.ts |
Updated placeholder to show complete JSON Schema structure with top-level type, properties, and required fields |
web/i18n/*/app-debug.json (21 files) |
Added two new error message translations: jsonSchemaInvalid and jsonSchemaMustBeObject for JSON Schema validation errors across all supported languages |
Comments suppressed due to low confidence (1)
web/app/components/app/configuration/config-var/config-modal/index.tsx:143
- The function returns
nullon empty input (line 134) and parsing errors (line 141), but these return values are never used. ThehandleJSONSchemaChangecallback is passed to the CodeEditor component which likely doesn't utilize the return value. Consider either removing the return statements or documenting why they exist if they serve a specific purpose in the CodeEditor's onChange handler.
const handleJSONSchemaChange = useCallback((value: string) => {
const isEmpty = value == null || value.trim() === ''
if (isEmpty) {
handlePayloadChange('json_schema')(undefined)
return null
}
try {
const v = JSON.parse(value)
handlePayloadChange('json_schema')(JSON.stringify(v, null, 2))
}
catch {
return null
}
}, [handlePayloadChange])
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: zhsama <torvalds@linux.do>
Summary
PR #29053 introduced
JSON_OBJECTsupport for user inputs. It also introduced an optional JSONSchema validation for json object inputs. However, theJSON_OBJECToption is not enabled in chatflow / workflow orchestration page, leading to confusions.This PR addresses the problem by removing relevant feature flags in frontend code. It also adjusts how the JSONSchema is edited: the original implementation fills the top level properties for the user, while the current implementation only ensures that the
typefield of JSONSchema isobjectif the isJSON Schemafield is set.Fix: #29519
Screenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods