json-object-editor 0.10.521 → 0.10.622
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/_www/mcp-nav.js +1 -0
- package/app.js +26 -2
- package/css/joe-styles.css +5 -0
- package/css/joe.css +23 -18
- package/css/joe.min.css +4 -4
- package/js/JsonObjectEditor.jquery.craydent.js +52 -61
- package/js/joe-ai.js +399 -0
- package/js/joe.js +54 -61
- package/js/joe.min.js +1 -1
- package/package.json +5 -5
- package/readme.md +139 -2
- package/server/app-config.js +2 -1
- package/server/fields/core.js +35 -17
- package/server/modules/Server.js +50 -0
- package/server/modules/Storage.js +7 -1
- package/server/modules/Utils.js +2 -1
- package/server/plugins/awsConnect.js +51 -20
- package/server/plugins/chatgpt-assistants.js +3 -3
- package/server/plugins/chatgpt-responses.js +45 -0
- package/server/plugins/chatgpt.js +729 -0
- package/server/plugins/notifier.js +122 -8
- package/server/schemas/ai_assistant.js +255 -0
- package/server/schemas/ai_conversation.js +34 -0
- package/server/schemas/ai_prompt.js +323 -0
- package/server/schemas/ai_response.js +217 -0
- package/server/schemas/ai_tool.js +30 -0
- package/server/schemas/ai_widget_conversation.js +110 -0
- package/server/schemas/notification.js +48 -0
- package/server/schemas/task.js +5 -0
- package/server/webconfig.js +3 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var schema = {
|
|
2
|
+
title: "AI Widget Conversation | ${name||_id}",
|
|
3
|
+
display: "AI Widget Conversation",
|
|
4
|
+
info: "Lightweight conversation log for external AI widgets.",
|
|
5
|
+
summary:{
|
|
6
|
+
description:'Lightweight, persistent conversation record for embeddable AI widgets.',
|
|
7
|
+
purpose:'Use ai_widget_conversation to store model choice, assistant linkage, system instructions, and a compact message array for widget chats. Widgets read/write this schema via the chatgpt widgetStart/widgetMessage/widgetHistory endpoints.',
|
|
8
|
+
wip:true,
|
|
9
|
+
labelField:'name',
|
|
10
|
+
defaultSort:{ field:'last_message_at', dir:'desc' },
|
|
11
|
+
searchableFields:['name','info','model','assistant_id','source','_id'],
|
|
12
|
+
allowedSorts:['last_message_at','created','joeUpdated','name'],
|
|
13
|
+
relationships:{
|
|
14
|
+
outbound:[
|
|
15
|
+
{ field:'assistant', targetSchema:'ai_assistant', cardinality:'one' },
|
|
16
|
+
{ field:'tags', targetSchema:'tag', cardinality:'many' }
|
|
17
|
+
],
|
|
18
|
+
inbound:{ graphRef:'server/relationships.graph.json' }
|
|
19
|
+
},
|
|
20
|
+
joeManagedFields:['created','joeUpdated'],
|
|
21
|
+
fields:[
|
|
22
|
+
{ name:'_id', type:'string', required:true },
|
|
23
|
+
{ name:'itemtype', type:'string', required:true, const:'ai_widget_conversation' },
|
|
24
|
+
{ name:'name', type:'string' },
|
|
25
|
+
{ name:'info', type:'string' },
|
|
26
|
+
{ name:'model', type:'string' },
|
|
27
|
+
{ name:'assistant', type:'string', isReference:true, targetSchema:'ai_assistant' },
|
|
28
|
+
{ name:'assistant_id', type:'string' },
|
|
29
|
+
{ name:'system', type:'string' },
|
|
30
|
+
{ name:'messages', type:'objectList' },
|
|
31
|
+
{ name:'last_message_at', type:'string', format:'date-time' },
|
|
32
|
+
{ name:'source', type:'string' },
|
|
33
|
+
{ name:'tags', type:'string', isArray:true, isReference:true, targetSchema:'tag' },
|
|
34
|
+
{ name:'joeUpdated', type:'string', format:'date-time' },
|
|
35
|
+
{ name:'created', type:'string', format:'date-time' }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
listView: {
|
|
39
|
+
title: "<joe-title>${name||_id}</joe-title><joe-subtitle>${model}</joe-subtitle><joe-subtext>${last_message_at}</joe-subtext>",
|
|
40
|
+
listWindowTitle: "AI Widget Conversations"
|
|
41
|
+
},
|
|
42
|
+
fields: function () {
|
|
43
|
+
return [
|
|
44
|
+
"name",
|
|
45
|
+
"info",
|
|
46
|
+
|
|
47
|
+
{ section_start: "conversation", display: "Conversation", collapsed: false },
|
|
48
|
+
{
|
|
49
|
+
name: "model",
|
|
50
|
+
type: "select",
|
|
51
|
+
values: "ai_model",
|
|
52
|
+
display: "Model",
|
|
53
|
+
comment: "Default OpenAI model used for this conversation."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "assistant",
|
|
57
|
+
type: "objectReference",
|
|
58
|
+
values: "ai_assistant",
|
|
59
|
+
display: "Assistant (JOE)",
|
|
60
|
+
comment: "Optional link to an ai_assistant config used by this widget."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "assistant_id",
|
|
64
|
+
type: "text",
|
|
65
|
+
display: "OpenAI Assistant ID",
|
|
66
|
+
comment: "Optional OpenAI assistant used for this conversation."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "system",
|
|
70
|
+
type: "code",
|
|
71
|
+
display: "System Instructions",
|
|
72
|
+
height: "160px",
|
|
73
|
+
comment: "Effective system prompt used for this conversation."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "messages",
|
|
77
|
+
type: "code",
|
|
78
|
+
display: "Messages (JSON)",
|
|
79
|
+
height: "260px",
|
|
80
|
+
comment: "Array of {role, content, created_at}. Managed by the widget API."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "last_message_at",
|
|
84
|
+
type: "date",
|
|
85
|
+
display: "Last Message At",
|
|
86
|
+
locked: true
|
|
87
|
+
},
|
|
88
|
+
{ section_end: "conversation" },
|
|
89
|
+
|
|
90
|
+
{ section_start: "meta", collapsed: true },
|
|
91
|
+
"source",
|
|
92
|
+
"tags",
|
|
93
|
+
{ section_end: "meta" },
|
|
94
|
+
|
|
95
|
+
{ section_start: "system", collapsed: true },
|
|
96
|
+
"_id",
|
|
97
|
+
"created",
|
|
98
|
+
"joeUpdated",
|
|
99
|
+
"itemtype",
|
|
100
|
+
{ section_end: "system" }
|
|
101
|
+
];
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
idprop: "_id",
|
|
105
|
+
sorter: ["!last_message_at", "!created"]
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
module.exports = schema;
|
|
109
|
+
|
|
110
|
+
|
|
@@ -2,6 +2,29 @@ var notification ={
|
|
|
2
2
|
info:"A notification is an automated message, sent when an action is taken (ex: new subscriber email). A notification can be an email, sms, or system.",
|
|
3
3
|
default_schema:true,
|
|
4
4
|
title: '${name}',
|
|
5
|
+
methods:{
|
|
6
|
+
sendTest: async function(notificationId){
|
|
7
|
+
try{
|
|
8
|
+
var recipients = _jco(true).test_recipients || [];
|
|
9
|
+
if(!recipients.length){ alert('Please add at least one recipient'); return; }
|
|
10
|
+
var body = { notification: notificationId, recipients: recipients };
|
|
11
|
+
var res = await fetch('/API/plugin/notifier/testNotification', {
|
|
12
|
+
method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify(body)
|
|
13
|
+
});
|
|
14
|
+
var json = await res.json();
|
|
15
|
+
if(!res.ok || (json && (json.error || (json.errors && json.errors.length)))){
|
|
16
|
+
var errMsg = (json && (json.error || (json.errors && json.errors[0] && (json.errors[0].error||json.errors[0])))) || ('HTTP '+res.status);
|
|
17
|
+
alert('Send failed: '+(errMsg.message||errMsg));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if(json && json.status === 'partial'){
|
|
21
|
+
(_joe.toast && _joe.toast('Test partially sent')) || alert('Test partially sent');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
(_joe.toast && _joe.toast('Test sent')) || alert('Test sent');
|
|
25
|
+
}catch(e){ alert('Failed: '+e); }
|
|
26
|
+
}
|
|
27
|
+
},
|
|
5
28
|
// Curated summary for agents
|
|
6
29
|
summary:{
|
|
7
30
|
description:'Automated outbound message configuration (email/SMS/system).',
|
|
@@ -46,6 +69,31 @@ var notification ={
|
|
|
46
69
|
'subject',
|
|
47
70
|
'content',
|
|
48
71
|
'text:rendering',
|
|
72
|
+
{sidebar_start:'right',collapsed:false},
|
|
73
|
+
{section_start:'test',display:'Send Test',collapsed:false},
|
|
74
|
+
{name:'test_recipients', display:'Recipient(s)', type:'objectReference', idprop:'_id',
|
|
75
|
+
template:function(recipient){
|
|
76
|
+
return `<joe-title>${recipient.name}</joe-title>
|
|
77
|
+
<joe-subtext>${recipient.fullname||''}</joe-subtext>
|
|
78
|
+
<joe-subtext>${recipient.email||recipient._id}</joe-subtext>`},
|
|
79
|
+
values:function(note){
|
|
80
|
+
try{
|
|
81
|
+
if(note && note.dataset){
|
|
82
|
+
return _joe.getDataset(note.dataset)||[];
|
|
83
|
+
}
|
|
84
|
+
}catch(e){}
|
|
85
|
+
return _joe.getDataset('user')||[];
|
|
86
|
+
},
|
|
87
|
+
comment:'Search and add one or more recipients from the configured dataset'
|
|
88
|
+
},
|
|
89
|
+
{name:'send_test', type:'button', display:'Send Test', icon:'email',
|
|
90
|
+
onclick:function(note){
|
|
91
|
+
if(!note || !note._id){ return ''; }
|
|
92
|
+
return `_joe.schemas.notification.methods.sendTest('${note._id}');`;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{section_end:'test'},
|
|
96
|
+
{sidebar_end:'right'},
|
|
49
97
|
'_id','created','itemtype'
|
|
50
98
|
],
|
|
51
99
|
|
package/server/schemas/task.js
CHANGED
|
@@ -176,6 +176,11 @@ var task = function(){return{
|
|
|
176
176
|
},
|
|
177
177
|
fields:function(){
|
|
178
178
|
var fields = [
|
|
179
|
+
{sidebar_start:'left'},
|
|
180
|
+
{section_start:'JAI',display:'JOE Ai'},
|
|
181
|
+
"objectChat",
|
|
182
|
+
{section_end:'JAI'},
|
|
183
|
+
{sidebar_end:'left'},
|
|
179
184
|
{section_start:'overview'},
|
|
180
185
|
'name',
|
|
181
186
|
'info',
|
package/server/webconfig.js
CHANGED
|
@@ -20,7 +20,9 @@ var joewebconfig = {
|
|
|
20
20
|
pluginsDir:'_plugins',
|
|
21
21
|
templatesDir:'_templates',
|
|
22
22
|
//httpsPort:2100,
|
|
23
|
-
default_schemas:['user','group','goal','initiative','event','report','tag','status','workflow','list','notification','note','include','instance','setting'
|
|
23
|
+
default_schemas:['user','group','goal','initiative','event','report','tag','status','workflow','list','notification','note','include','instance','setting',
|
|
24
|
+
'ai_assistant','ai_conversation','ai_response','ai_tool','ai_prompt','ai_widget_conversation'
|
|
25
|
+
]
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
|