Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2026, Codeventurers and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Nextgenie Settings", {
// refresh(frm) {

// },
// });
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"actions": [],
"creation": "2026-07-04 00:00:00.000000",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"enabled",
"anthropic_api_key",
"column_break_model",
"model",
"max_tokens",
"section_break_prompt",
"system_prompt"
],
"fields": [
{
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enable AI Assistant"
},
{
"fieldname": "anthropic_api_key",
"fieldtype": "Password",
"label": "Anthropic API Key",
"mandatory_depends_on": "eval:doc.enabled"
},
{
"fieldname": "column_break_model",
"fieldtype": "Column Break"
},
{
"default": "claude-sonnet-5",
"fieldname": "model",
"fieldtype": "Select",
"label": "Model",
"options": "claude-opus-4-8\nclaude-sonnet-5\nclaude-haiku-4-5"
},
{
"default": "1024",
"fieldname": "max_tokens",
"fieldtype": "Int",
"label": "Max Output Tokens"
},
{
"fieldname": "section_break_prompt",
"fieldtype": "Section Break",
"label": "System Prompt"
},
{
"default": "You are NextGenie, a helpful and professional HR assistant.\nYou help employees with leave management, payroll queries, attendance,\nonboarding, company policies, and HR-related questions.\nAlways be polite, concise, and accurate. If you don't know something,\nsay so and suggest contacting the HR team directly.",
"fieldname": "system_prompt",
"fieldtype": "Small Text",
"label": "System Prompt"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2026-07-04 00:00:00.000000",
"modified_by": "Administrator",
"module": "Nextgenie",
"name": "Nextgenie Settings",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"row_format": "Dynamic",
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2025, Codeventurers and contributors
# Copyright (c) 2026, Codeventurers and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class NextGenieChatLog(Document):
class NextgenieSettings(Document):
pass
32 changes: 31 additions & 1 deletion nextgenie/nextgenie/page/nextgenie/nextgenie.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@
}

.hist-item {
display: block;
display: flex;
align-items: center;
gap: 6px;
padding: 9px 10px;
border-radius: 8px;
cursor: pointer;
Expand All @@ -172,6 +174,34 @@
border-color: rgba(201, 168, 76, 0.2);
}

.hist-item-body {
flex: 1;
min-width: 0;
}

.hist-item-delete {
flex-shrink: 0;
border: none;
background: transparent;
color: var(--ng-tm);
font-size: 12px;
line-height: 1;
padding: 4px 6px;
border-radius: 6px;
cursor: pointer;
opacity: 0;
transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.hist-item:hover .hist-item-delete {
opacity: 1;
}

.hist-item-delete:hover {
background: rgba(220, 60, 60, 0.12);
color: #d64545;
}

.hist-item-title {
display: block;
font-size: 12px;
Expand Down
58 changes: 53 additions & 5 deletions nextgenie/nextgenie/page/nextgenie/nextgenie.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ frappe.pages['nextgenie'].on_page_load = function (wrapper) {
$(wrapper).closest('.page-wrapper').find('.page-head').hide();
}, 0);

// Hide the global Frappe navbar while on this page, restore it elsewhere
function toggleNavbar() {
var on_nextgenie = frappe.get_route()[0] === 'nextgenie';
$('.navbar').closest('.sticky-top').toggle(!on_nextgenie);
}

toggleNavbar();
frappe.router.on('change', toggleNavbar);

page.main.css({ 'padding': '0', 'margin': '0' });
$(page.main).addClass('ng-page-main');

Expand Down Expand Up @@ -44,14 +53,53 @@ frappe.pages['nextgenie'].on_page_load = function (wrapper) {
.addClass('hist-item')
.toggleClass('active', s.id === activeId);

$('<div>').addClass('hist-item-title').text(s.title).appendTo($item);
$('<div>').addClass('hist-item-date').text(s.date || '').appendTo($item);
var $body = $('<div>').addClass('hist-item-body');
$('<div>').addClass('hist-item-title').text(s.title).appendTo($body);
$('<div>').addClass('hist-item-date').text(s.date || '').appendTo($body);
$item.append($body);

var $del = $('<button>')
.addClass('hist-item-delete')
.attr('title', 'Delete chat')
.text('🗑')
.on('click', function (e) {
e.stopPropagation();
deleteSession(s.id);
});
$item.append($del);

$item.on('click', function () { loadSession(s.id); });
$body.on('click', function () { loadSession(s.id); });
$list.append($item);
});
}

// ── Delete session ─────────────────────────────────

function deleteSession(id) {
frappe.confirm(
'Delete this chat? This cannot be undone.',
function () {
frappe.call({
method: 'nextgenie.nextgenie.page.nextgenie.nextgenie.delete_session',
args: { session_id: id },
callback: function () {
sessions = sessions.filter(function (x) { return x.id !== id; });

if (activeId === id) {
if (sessions.length) {
loadSession(sessions[0].id);
} else {
createNewSession();
}
} else {
renderHistory();
}
}
});
}
);
}

// ── Load session messages ─────────────────────────

function loadSession(id) {
Expand Down Expand Up @@ -227,7 +275,7 @@ frappe.pages['nextgenie'].on_page_load = function (wrapper) {
$(document).on('click', '#new-chat-btn', createNewSession);

$(document).on('click', '#clear-btn', function () {
if (confirm('Clear this chat?')) {
frappe.confirm('Clear this chat?', function () {
frappe.call({
method: 'nextgenie.nextgenie.page.nextgenie.nextgenie.clear_session_messages',
args: { session_id: activeId },
Expand All @@ -236,7 +284,7 @@ frappe.pages['nextgenie'].on_page_load = function (wrapper) {
appendMessage('Genie', 'Chat cleared. How can I assist you?');
}
});
}
});
});

$(document).on('click', '#quick-actions li', function () {
Expand Down
Loading
Loading