Skip to content

OpenConceptLab/ocl_online#81 | Using AI Assistant to generate change comment in concept#25

Open
snyaggarwal wants to merge 6 commits into
mainfrom
ocl_online/issues#81
Open

OpenConceptLab/ocl_online#81 | Using AI Assistant to generate change comment in concept#25
snyaggarwal wants to merge 6 commits into
mainfrom
ocl_online/issues#81

Conversation

@snyaggarwal

Copy link
Copy Markdown
Contributor

Linked Issue

Refs: OpenConceptLab/ocl_online#81

@snyaggarwal snyaggarwal requested a review from paynejd June 1, 2026 05:26
@snyaggarwal snyaggarwal self-assigned this Jun 1, 2026

@paynejd paynejd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review changes as discussed — most are inline suggestions you can commit directly. Two items can't be expressed as suggestions and are noted below.

1. New i18n keys (can't suggest — translations.json isn't in this PR's diff)

Add to src/i18n/locales/en/translations.json (and es/zh, or they'll fall back to en):

// "common": { ...
"generate_with_ai": "Generate with AI",
// "concept": { ...
"ai_assistant_not_configured": "AI assistant is not configured for this environment.",
"make_change_before_generating": "Make a change to the concept before generating a comment.",
"generate_comment_aria": "Generate comment with AI",
"try_again_in_a_moment": "Try again in a moment."

2. Backend auth (context, not a code change here)

Server-side, POST /prompts/{key}/$invoke/ calls check_auth_group(MAPPER_AI_ASSISTANT_GROUP) (mapper_ai_assistant) — it is not superuser-gated. So the front-end visibility gate (superuser / core_user) and the back-end permission (mapper_ai_assistant) are different groups. That's the intended "safe even if it doesn't yet work for everyone" state — worth a follow-up ticket to align the groups before opening this to all users.

Comment thread src/components/concepts/ConceptForm.jsx
Comment thread src/components/concepts/ConceptForm.jsx Outdated
Comment thread src/components/concepts/ConceptForm.jsx Outdated
Comment thread src/components/concepts/ConceptForm.jsx Outdated
Comment thread src/components/concepts/ConceptForm.jsx Outdated
Comment thread src/components/concepts/ConceptForm.jsx Outdated
Comment thread src/components/concepts/ConceptForm.jsx Outdated

@paynejd paynejd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Duplicate of the review directly below — disregard. Posted twice by accident; inline suggestions removed from this copy.)

@paynejd paynejd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against ocl_online#81. Overall a clean, faithful implementation — env-var plumbing mirrors the existing ANALYTICS_API pattern, token forwarding works via currentUserToken(), metadata-exclusion lists match the spec, and the loading/disabled/tooltip states cover the acceptance criteria. A few inline notes below, plus one cross-repo dependency on backend permissions.

Comment thread src/components/concepts/ConceptForm.jsx Outdated
const { conceptClasses, datatypes, locales, nameTypes, descriptionTypes, fields } = this.state
const { conceptClasses, datatypes, locales, nameTypes, descriptionTypes, fields, generatingChangeComment } = this.state
const aiAssistantConfigured = Boolean(this.getAIAssistantURL())
const canSeeGenerateComment = edit && (isSuperuser() || hasAuthGroup(getCurrentUser(), 'core_user'))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gates the button to core_users in addition to superusers, but per the ticket the AI Assistant $invoke endpoint still requires superuser — it notes this "must be relaxed to allow staff/authenticated users before this feature ships (separate ticket needed)." @snyaggarwal could you take the backend permissions work so core_users can actually invoke this? Otherwise non-superuser core_users will see the button and hit a 403.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, raising separate PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/components/concepts/ConceptForm.jsx Outdated
Comment thread src/i18n/locales/es/translations.json Outdated
Comment thread src/i18n/locales/zh/translations.json
snyaggarwal and others added 2 commits June 15, 2026 13:38
Co-authored-by: Jonathan Payne <paynejd@gmail.com>
Co-authored-by: Jonathan Payne <paynejd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants