Skip to content

chore: Ui corrections - #5

Merged
Vishnu7025 merged 2 commits into
developfrom
vishnu-dev-new
Jul 4, 2026
Merged

chore: Ui corrections#5
Vishnu7025 merged 2 commits into
developfrom
vishnu-dev-new

Conversation

@Vishnu7025

@Vishnu7025 Vishnu7025 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added a settings screen to configure the AI assistant, including enabling/disabling it, model selection, token limits, and API key/prompt options.
    • Chat history now includes a visible delete action for individual sessions.
    • The chat page now hides the main navigation for a more focused experience.
  • Bug Fixes

    • Added safeguards so users can only access and modify their own chat sessions.
    • Improved confirmation prompts for deleting chats and clearing message history.

@Vishnu7025
Vishnu7025 merged commit 24895db into develop Jul 4, 2026
0 of 2 checks passed
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 410cdf58-dd7e-4abc-834d-a32360d41857

📥 Commits

Reviewing files that changed from the base of the PR and between eacba43 and fb31b35.

📒 Files selected for processing (10)
  • nextgenie/nextgenie/doctype/nextgenie_chat_log/nextgenie_chat_log.js
  • nextgenie/nextgenie/doctype/nextgenie_chat_log/nextgenie_chat_log.json
  • nextgenie/nextgenie/doctype/nextgenie_chat_log/test_nextgenie_chat_log.py
  • nextgenie/nextgenie/doctype/nextgenie_settings/__init__.py
  • nextgenie/nextgenie/doctype/nextgenie_settings/nextgenie_settings.js
  • nextgenie/nextgenie/doctype/nextgenie_settings/nextgenie_settings.json
  • nextgenie/nextgenie/doctype/nextgenie_settings/nextgenie_settings.py
  • nextgenie/nextgenie/page/nextgenie/nextgenie.css
  • nextgenie/nextgenie/page/nextgenie/nextgenie.js
  • nextgenie/nextgenie/page/nextgenie/nextgenie.py

📝 Walkthrough

Walkthrough

This PR removes the NextGenie Chat Log doctype (JSON, client script, tests), adds a new Nextgenie Settings doctype with AI assistant configuration fields, renames the settings backend class, updates chat page UI with session deletion and navbar toggling, and adds session ownership authorization checks to backend chat endpoints.

Changes

Chat Log Removal and Settings Doctype

Layer / File(s) Summary
Remove chat log doctype
nextgenie/nextgenie/doctype/nextgenie_chat_log/*
Deletes the doctype JSON schema, client script stub, and test class for NextGenie Chat Log.
New settings doctype schema
nextgenie/nextgenie/doctype/nextgenie_settings/nextgenie_settings.json
Adds DocType with enabled checkbox, conditional Anthropic API key, model selector, max tokens, and system prompt fields, plus permissions.
Settings backend class and client stub
nextgenie/nextgenie/doctype/nextgenie_settings/nextgenie_settings.py, nextgenie/nextgenie/doctype/nextgenie_settings/nextgenie_settings.js
Renames document class from NextGenieChatLog to NextgenieSettings and adds a commented client script stub.

Chat Page UI and Session Security

Layer / File(s) Summary
History item styling
nextgenie/nextgenie/page/nextgenie/nextgenie.css
Converts .hist-item to flex layout and adds hover-revealed delete button styling.
Session deletion flow
nextgenie/nextgenie/page/nextgenie/nextgenie.js
Splits history rendering into body/delete button, adds deleteSession(id) with confirmation calling backend delete_session, updates local state.
Navbar toggle and clear chat confirmation
nextgenie/nextgenie/page/nextgenie/nextgenie.js
Adds route-based navbar toggling and replaces native confirm() with frappe.confirm() for clearing chat.
Session ownership enforcement
nextgenie/nextgenie/page/nextgenie/nextgenie.py
Adds _check_session_owner helper and enforces it across session/message endpoints, raising PermissionError on mismatch.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant nextgenie_js as nextgenie.js (Client)
    participant Backend as nextgenie.py
    participant DB as Genie Chat Session/Message

    User->>nextgenie_js: Click delete button on history item
    nextgenie_js->>User: frappe.confirm dialog
    User->>nextgenie_js: Confirm deletion
    nextgenie_js->>Backend: delete_session(id)
    Backend->>Backend: _check_session_owner(session_id)
    Backend->>DB: Delete Genie Chat Message rows
    Backend->>DB: Delete Genie Chat Session
    Backend-->>nextgenie_js: success payload
    nextgenie_js->>nextgenie_js: Update local sessions list
    alt deleted session was active
        nextgenie_js->>Backend: load next session or create new
    else
        nextgenie_js->>nextgenie_js: Re-render history
    end
Loading

Possibly related PRs

  • CodeVenturers/NextGenie#2: Both PRs touch the nextgenie_chat_log doctype artifacts, one removing them and the other modifying them.
  • CodeVenturers/NextGenie#4: Adds ownership checks to the same session/message endpoints introduced by the session-based chat backend in the referenced PR.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch vishnu-dev-new

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant