cpee 2.1.125 → 2.1.126
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.
- checksums.yaml +4 -4
- data/cockpit/compliance.html +301 -0
- data/cockpit/css/compliance.css +38 -0
- data/cockpit/css/llm.css +15 -4
- data/cockpit/css/llm_active.svg +43 -0
- data/cockpit/css/llm_inactive.svg +43 -0
- data/cockpit/css/mode_active.svg +85 -0
- data/cockpit/css/mode_inactive.svg +77 -0
- data/cockpit/css/ui.css +10 -1
- data/cockpit/js/compliance.js +134 -0
- data/cockpit/js/instance.js +6 -1
- data/cockpit/js/llm.js +254 -86
- data/cockpit/js/parameters.js +19 -12
- data/cockpit/js/wfadaptor.js +49 -12
- data/cockpit/llm.html +34 -7
- data/cockpit/only_llm.html +15 -7
- data/cockpit/rngs/requirements.rng +8 -0
- data/cockpit/themes/base.js +1 -0
- data/cockpit/themes/control/rngs/choose.rng +8 -1
- data/cockpit/themes/control/rngs/parallel.rng +4 -10
- data/cockpit/themes/dataflow/rngs/choose.rng +8 -1
- data/cockpit/themes/dataflow/rngs/parallel.rng +4 -10
- data/cockpit/themes/default/rngs/choose.rng +8 -1
- data/cockpit/themes/default/rngs/parallel.rng +4 -10
- data/cockpit/themes/extended/rngs/choose.rng +8 -1
- data/cockpit/themes/extended/rngs/parallel.rng +4 -10
- data/cockpit/themes/packed/rngs/choose.rng +8 -1
- data/cockpit/themes/packed/rngs/parallel.rng +4 -10
- data/cockpit/themes/preset/rngs/choose.rng +8 -1
- data/cockpit/themes/preset/rngs/parallel.rng +4 -10
- data/cockpit/themes/presetaltid/rngs/choose.rng +8 -1
- data/cockpit/themes/presetaltid/rngs/parallel.rng +4 -10
- data/cockpit/themes/presetid/rngs/choose.rng +8 -1
- data/cockpit/themes/presetid/rngs/parallel.rng +4 -10
- data/cockpit/themes/reduced/rngs/choose.rng +8 -1
- data/cockpit/themes/reduced/rngs/parallel.rng +4 -10
- data/cpee.gemspec +1 -1
- data/server/executionhandlers/ruby/connection.rb +2 -2
- data/server/executionhandlers/ruby/dsl_to_dslx.xsl +20 -3
- data/server/routing/persist.rb +1 -5
- metadata +9 -1
data/cockpit/js/llm.js
CHANGED
|
@@ -2,44 +2,45 @@ var last_generated_model = undefined;
|
|
|
2
2
|
var last_model_before_generation =undefined;
|
|
3
3
|
var default_llm = "gemini-2.5-flash-lite";
|
|
4
4
|
|
|
5
|
-
function clean_llm_ui(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
5
|
+
function clean_llm_ui(status) { //{{{
|
|
6
|
+
status.empty();
|
|
7
|
+
status.removeClass('error').removeClass('success');
|
|
8
|
+
status.removeClass('error').removeClass('error');
|
|
9
|
+
status.removeClass('error').removeClass('loading');
|
|
10
|
+
} //}}}
|
|
12
11
|
|
|
13
|
-
function querying_llm_ui(
|
|
14
|
-
|
|
15
|
-
let myllm = $(`#${llm_id}`).find(":selected").val();
|
|
12
|
+
function querying_llm_ui(status,llm,what) { //{{{
|
|
13
|
+
let myllm = llm.find(":selected").val();
|
|
16
14
|
if (myllm === undefined){ myllm = default_llm; }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
status.addClass('loading');
|
|
16
|
+
status.text('Agent ' + what + ' (' + myllm + ')');
|
|
17
|
+
} //}}}
|
|
20
18
|
|
|
21
|
-
function add_prompt(
|
|
22
|
-
let input = $(`#${prompt_id}`);
|
|
19
|
+
function add_prompt(input,content) { //{{{
|
|
23
20
|
const range = document.createRange();
|
|
24
21
|
const selection = window.getSelection();
|
|
25
22
|
range.selectNodeContents(input[0]);
|
|
26
23
|
selection.removeAllRanges();
|
|
27
24
|
selection.addRange(range);
|
|
28
25
|
document.execCommand('insertText', false, content);
|
|
29
|
-
}
|
|
26
|
+
} //}}}
|
|
30
27
|
|
|
31
|
-
function
|
|
32
|
-
let input = $(`#${prompt_id}`);
|
|
33
|
-
let text = input[0].innerText;
|
|
34
|
-
let myllm = $(`#${llm_id}`).find(":selected").val();
|
|
35
|
-
if (myllm === undefined){ myllm = default_llm; }
|
|
28
|
+
function call_llm_service_model(dslx,input,llm,prompt_type) { //{{{
|
|
36
29
|
const formData = new FormData();
|
|
37
|
-
const blob1 = new Blob([
|
|
30
|
+
const blob1 = new Blob([dslx], { type: "text/xml" });
|
|
38
31
|
formData.append("rpst_xml", blob1);
|
|
39
|
-
const blob2 = new Blob([
|
|
32
|
+
const blob2 = new Blob([input], { type: "text/plain" });
|
|
40
33
|
formData.append("user_input", blob2);
|
|
41
|
-
const blob3 = new Blob([
|
|
34
|
+
const blob3 = new Blob([llm], { type: "text/plain" });
|
|
42
35
|
formData.append("llm", blob3);
|
|
36
|
+
const blob4 = new Blob([prompt_type], { type: "text/plain" });
|
|
37
|
+
formData.append("prompt_type", blob4);
|
|
38
|
+
if (prompt_type == 'adapt_endpoints') {
|
|
39
|
+
const blob5 = new Blob([save['endpoints'].save_text()], { type: "text/xml" });
|
|
40
|
+
formData.append("endpoints", blob5);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let def = new $.Deferred();
|
|
43
44
|
|
|
44
45
|
jQuery.ajax({
|
|
45
46
|
url: $('body').attr('current-llm-service'),
|
|
@@ -49,28 +50,70 @@ function call_llm_service(status_id,prompt_id,llm_id) {
|
|
|
49
50
|
processData: false,
|
|
50
51
|
method: 'POST',
|
|
51
52
|
success: function(data){
|
|
52
|
-
|
|
53
|
-
last_generated_model = data.output_cpee;
|
|
54
|
-
let send = $X(data.output_cpee);
|
|
55
|
-
$('label',send).each((_,ele)=>{
|
|
56
|
-
if ($(ele).text() == "Start Fermenter") {
|
|
57
|
-
$(ele).parent().parent().attr('endpoint','fermenter');
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
set_cpee_model(send.serializePrettyXML(),["<!-- Input CPEE-Tree -->\n"+data.input_cpee,"# User Input:\n"+data.user_input,"# Used LLM:\n"+data.used_llm,"%% Input Intermediate\n"+data.input_intermediate,"%% Output Intermediate\n"+data.output_intermediate,"<!-- Output CPEE-Tree -->\n"+data.output_cpee]);
|
|
61
|
-
set_success(status_id,data.status);
|
|
53
|
+
def.resolve(data);
|
|
62
54
|
},
|
|
63
55
|
error: function(xhr, status, data) {
|
|
64
|
-
|
|
65
|
-
set_error(status_id,xhr.responseJSON.error);
|
|
56
|
+
def.reject(xhr);
|
|
66
57
|
}
|
|
67
58
|
});
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
}
|
|
60
|
+
return def.promise();
|
|
61
|
+
} //}}}
|
|
62
|
+
function call_llm_service_dataflow(model,llm) { //{{{
|
|
63
|
+
const formData = new FormData();
|
|
64
|
+
const blob1 = new Blob([model], { type: "text/xml" });
|
|
65
|
+
formData.append("rpst_xml", blob1);
|
|
66
|
+
const blob2 = new Blob([llm], { type: "text/plain" });
|
|
67
|
+
formData.append("llm", blob2);
|
|
68
|
+
|
|
69
|
+
let def = new $.Deferred();
|
|
70
|
+
|
|
71
|
+
jQuery.ajax({
|
|
72
|
+
url: $('body').attr('current-llm-service') + '/dataflow/',
|
|
73
|
+
data: formData,
|
|
74
|
+
cache: false,
|
|
75
|
+
contentType: false,
|
|
76
|
+
processData: false,
|
|
77
|
+
method: 'POST',
|
|
78
|
+
success: function(data){
|
|
79
|
+
def.resolve(data);
|
|
80
|
+
},
|
|
81
|
+
error: function(xhr, status, data) {
|
|
82
|
+
def.reject(xhr);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return def.promise();
|
|
87
|
+
} //}}}
|
|
88
|
+
function call_llm_service_validation(model,llm) { //{{{
|
|
89
|
+
const formData = new FormData();
|
|
90
|
+
const blob1 = new Blob([model], { type: "text/xml" });
|
|
91
|
+
formData.append("rpst_xml", blob1);
|
|
92
|
+
const blob2 = new Blob([llm], { type: "text/plain" });
|
|
93
|
+
formData.append("llm", blob2);
|
|
94
|
+
|
|
95
|
+
let def = new $.Deferred();
|
|
96
|
+
|
|
97
|
+
jQuery.ajax({
|
|
98
|
+
url: $('body').attr('current-llm-service') + '/validate/xml/',
|
|
99
|
+
data: formData,
|
|
100
|
+
cache: false,
|
|
101
|
+
contentType: false,
|
|
102
|
+
processData: false,
|
|
103
|
+
method: 'POST',
|
|
104
|
+
success: function(data){
|
|
105
|
+
def.resolve(data);
|
|
106
|
+
},
|
|
107
|
+
error: function(xhr, status, data) {
|
|
108
|
+
def.reject(xhr);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return def.promise();
|
|
113
|
+
} //}}}
|
|
71
114
|
|
|
72
|
-
function call_llm_text_service(
|
|
73
|
-
let myllm =
|
|
115
|
+
function call_llm_text_service(status,prompt,llms,action) { //{{{
|
|
116
|
+
let myllm = llms.find(":selected").val();
|
|
74
117
|
if (myllm === undefined){ myllm = default_llm; }
|
|
75
118
|
const info = save.attributes_raw.info;
|
|
76
119
|
const formData = new FormData();
|
|
@@ -88,7 +131,7 @@ function call_llm_text_service(status_id,prompt_id,llm_id,action) {
|
|
|
88
131
|
method: 'POST',
|
|
89
132
|
success: function(data){
|
|
90
133
|
if (action=="show"){
|
|
91
|
-
add_prompt(
|
|
134
|
+
add_prompt(prompt,data["output_text"]);
|
|
92
135
|
} else if (action=="file") {
|
|
93
136
|
$('#savetext').attr('download', info + '.txt');
|
|
94
137
|
const encodedText = encodeURIComponent(data["output_text"]);
|
|
@@ -98,15 +141,15 @@ function call_llm_text_service(status_id,prompt_id,llm_id,action) {
|
|
|
98
141
|
link.click();
|
|
99
142
|
};
|
|
100
143
|
last_model_before_generation = save['dslx'];
|
|
101
|
-
set_success(
|
|
144
|
+
set_success(status,data.status);
|
|
102
145
|
},
|
|
103
|
-
error: function(xhr,
|
|
104
|
-
set_error(
|
|
146
|
+
error: function(xhr, stat, data) {
|
|
147
|
+
set_error(status,xhr.responseJSON.error);
|
|
105
148
|
}
|
|
106
149
|
});
|
|
107
|
-
}
|
|
150
|
+
} //}}}
|
|
108
151
|
|
|
109
|
-
function set_cpee_model(cpee_xml,expositions=[]) {
|
|
152
|
+
function set_cpee_model(cpee_xml,expositions=[]) { //{{{
|
|
110
153
|
const form_data = new FormData();
|
|
111
154
|
const blob = new Blob([cpee_xml], { type: "text/xml" });
|
|
112
155
|
form_data.append("dslx", blob);
|
|
@@ -123,87 +166,212 @@ function set_cpee_model(cpee_xml,expositions=[]) {
|
|
|
123
166
|
processData: false,
|
|
124
167
|
data: form_data
|
|
125
168
|
});
|
|
126
|
-
}
|
|
169
|
+
} //}}}
|
|
127
170
|
|
|
128
|
-
function set_success(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
171
|
+
function set_success(status,success_text) { //{{{
|
|
172
|
+
status.text(success_text);
|
|
173
|
+
status.addClass('success');
|
|
174
|
+
status.removeClass('loading');
|
|
175
|
+
status.removeClass('error');
|
|
176
|
+
} //}}}
|
|
134
177
|
|
|
135
|
-
function set_error(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
178
|
+
function set_error(status,error_text) { //{{{
|
|
179
|
+
status.text(error_text);
|
|
180
|
+
status.addClass('error');
|
|
181
|
+
status.removeClass('success');
|
|
182
|
+
status.removeClass('loading');
|
|
183
|
+
} //}}}
|
|
141
184
|
|
|
142
|
-
function empty_model(){
|
|
185
|
+
function empty_model(){ //{{{
|
|
143
186
|
set_cpee_model('<description xmlns="http://cpee.org/ns/description/1.0" xmlns:a="http://cpee.org/ns/annotation/1.0"/>',["Reset Context!"]);
|
|
144
187
|
$('#dat_details').empty();
|
|
145
|
-
}
|
|
146
|
-
function load_last_generated_model() {
|
|
188
|
+
} //}}}
|
|
189
|
+
function load_last_generated_model() { //{{{
|
|
147
190
|
set_cpee_model(last_generated_model === undefined ? save['dslx'] : last_generated_model);
|
|
148
|
-
}
|
|
149
|
-
function load_last_generated_model() {
|
|
191
|
+
} //}}}
|
|
192
|
+
function load_last_generated_model() { //{{{
|
|
150
193
|
set_cpee_model(last_generated_model === undefined ? save['dslx'] : last_generated_model);
|
|
151
|
-
}
|
|
194
|
+
} //}}}
|
|
152
195
|
|
|
153
|
-
function load_last_model_before_generation() {
|
|
196
|
+
function load_last_model_before_generation() { //{{{
|
|
154
197
|
set_cpee_model(last_model_before_generation === undefined ? save['dslx'] : last_model_before_generation);
|
|
155
|
-
}
|
|
198
|
+
} //}}}
|
|
156
199
|
|
|
157
|
-
function load_file_content(files) {
|
|
200
|
+
function load_file_content(files) { //{{{
|
|
158
201
|
if (typeof window.FileReader !== 'function') {
|
|
159
202
|
console.log('FileReader not yet supported');
|
|
160
203
|
return;
|
|
161
204
|
}
|
|
162
205
|
var reader = new FileReader();
|
|
163
206
|
reader.onload = function(){
|
|
164
|
-
clean_llm_ui('status');
|
|
207
|
+
clean_llm_ui($('#status'));
|
|
165
208
|
add_prompt('prompt',reader.result);
|
|
166
209
|
}
|
|
167
210
|
reader.onerror = function(){ console.log("reader error"); }
|
|
168
211
|
reader.onabort = function(){ console.log("reader abort"); }
|
|
169
212
|
reader.readAsText(files[0]);
|
|
213
|
+
} //}}}
|
|
214
|
+
|
|
215
|
+
function create(status,prompt,llms,generation,mode) {
|
|
216
|
+
clean_llm_ui(status);
|
|
217
|
+
|
|
218
|
+
// Imagine I want to implement a smart home system to control the lights in
|
|
219
|
+
// the dining room. Depending on the current lighting conditions, the
|
|
220
|
+
// system would automatically adjust the brightness—either increasing or
|
|
221
|
+
// reducing it as needed—and turn the lights off completely at night.
|
|
222
|
+
|
|
223
|
+
let input = prompt.text(); prompt.empty();
|
|
224
|
+
let myllm = llms.find(":selected").val();
|
|
225
|
+
let prompt_type = mode.find(":selected").val();
|
|
226
|
+
let gen = generation.find(":selected").val();
|
|
227
|
+
if (myllm === undefined){ myllm = default_llm; }
|
|
228
|
+
|
|
229
|
+
if ($X(save['dslx']).get(0).childElementCount == 0) {
|
|
230
|
+
prompt_type = 'generate_' + prompt_type;
|
|
231
|
+
} else {
|
|
232
|
+
prompt_type = 'adapt_' + prompt_type;
|
|
233
|
+
// always use adapt_endpoints when in dataflow mode
|
|
234
|
+
if (gen == 'dataflow') { prompt_type = 'adapt_endpoints'; }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
querying_llm_ui(status,llms,'creates model');
|
|
238
|
+
call_llm_service_model(save['dslx'],input,myllm,prompt_type).done((data) => {
|
|
239
|
+
let expositions = ["<!-- Input CPEE-Tree -->\n"+data.input_cpee,"# User Input:\n"+data.user_input,"# Used LLM:\n"+data.used_llm,"%% Input Intermediate\n"+data.input_intermediate,"%% Output Intermediate\n"+data.output_intermediate,"<!-- Output CPEE-Tree -->\n"+data.output_cpee];
|
|
240
|
+
if (prompt_type == 'adapt_endpoints') {
|
|
241
|
+
let testset = $X(data.output_cpee);
|
|
242
|
+
let model = $('> dslx > description',testset);
|
|
243
|
+
let endpoints = $('> endpoints',testset);
|
|
244
|
+
$.ajax({
|
|
245
|
+
type: "PATCH",
|
|
246
|
+
url: url + "/properties/endpoints/",
|
|
247
|
+
contentType: 'text/xml',
|
|
248
|
+
headers: {
|
|
249
|
+
'Content-ID': 'endpoints',
|
|
250
|
+
'CPEE-Event-Source': myid
|
|
251
|
+
},
|
|
252
|
+
data: endpoints.serializePrettyXML()
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
last_model_before_generation = save['dslx'];
|
|
256
|
+
last_generated_model = model.serializePrettyXML();
|
|
257
|
+
set_cpee_model(model.serializePrettyXML(),expositions);
|
|
258
|
+
set_success(status,data.status);
|
|
259
|
+
} else {
|
|
260
|
+
if (gen == "dataflow") {
|
|
261
|
+
querying_llm_ui(status,llms,'selects endpoints and calculates dataflow');
|
|
262
|
+
call_llm_service_dataflow($X(data.output_cpee).serializePrettyXML(),myllm).done((data) => {
|
|
263
|
+
let url = $('body').attr('current-instance');
|
|
264
|
+
$.ajax({
|
|
265
|
+
type: "PATCH",
|
|
266
|
+
url: url + "/properties/endpoints/",
|
|
267
|
+
contentType: 'text/xml',
|
|
268
|
+
headers: {
|
|
269
|
+
'Content-ID': 'endpoints',
|
|
270
|
+
'CPEE-Event-Source': myid
|
|
271
|
+
},
|
|
272
|
+
data: data.endpoints
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
querying_llm_ui(status,llms,'validates dataflow');
|
|
276
|
+
expositions.push("# Dataflow:\n"+data.dataflow);
|
|
277
|
+
call_llm_service_validation($X(data.output_cpee).serializePrettyXML(),myllm).done((data) => {
|
|
278
|
+
// for undo button
|
|
279
|
+
last_model_before_generation = save['dslx'];
|
|
280
|
+
last_generated_model = data.output_cpee;
|
|
281
|
+
set_cpee_model($X(data.output_cpee).serializePrettyXML(),expositions);
|
|
282
|
+
set_success(status,data.status);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
})
|
|
286
|
+
.fail((xhr) => {
|
|
287
|
+
set_error(status,xhr.responseJSON.error);
|
|
288
|
+
});
|
|
289
|
+
} else if (gen == "model") {
|
|
290
|
+
last_model_before_generation = save['dslx'];
|
|
291
|
+
last_generated_model = data.output_cpee;
|
|
292
|
+
set_cpee_model(data.output_cpee,expositions);
|
|
293
|
+
set_success(status,data.status);
|
|
294
|
+
} else {
|
|
295
|
+
set_success(status,"Successfully done nothing");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
.fail((xhr) => {
|
|
300
|
+
set_error(status,xhr.responseJSON.error);
|
|
301
|
+
});
|
|
170
302
|
}
|
|
171
303
|
|
|
172
|
-
$(document).ready(function() {
|
|
304
|
+
$(document).ready(async function() { //{{{
|
|
305
|
+
let llm_inactive = await $.get('css/llm_inactive.svg', 'xml').then(function(data) { return $(data.documentElement); });
|
|
306
|
+
let llm_active = await $.get('css/llm_active.svg', 'xml').then(function(data) { return $(data.documentElement); });
|
|
307
|
+
|
|
308
|
+
let mode_inactive = await $.get('css/mode_inactive.svg', 'xml').then(function(data) { return $(data.documentElement); });
|
|
309
|
+
let mode_active = await $.get('css/mode_active.svg', 'xml').then(function(data) { return $(data.documentElement); });
|
|
310
|
+
|
|
173
311
|
$(document).on('keydown','#prompt',function(e){
|
|
174
|
-
clean_llm_ui('status');
|
|
312
|
+
clean_llm_ui($('#status'));
|
|
175
313
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
176
|
-
|
|
177
|
-
call_llm_service('status',this.id,'llms');
|
|
314
|
+
create($('#status'),$('#prompt'),$('#llms'),$('#generation'),$('#mode'));
|
|
178
315
|
}
|
|
179
316
|
});
|
|
180
317
|
$(document).on('click','#prompt_submit_button',function(e){
|
|
181
|
-
|
|
182
|
-
querying_llm_ui('status','llms');
|
|
183
|
-
call_llm_service('status','prompt','llms');
|
|
318
|
+
create($('#status'),$('#prompt'),$('#llms'),$('#generation'),$('#mode'));
|
|
184
319
|
});
|
|
185
320
|
$(document).on('click','#prompt_reset_button',function(e){
|
|
186
|
-
clean_llm_ui('status');
|
|
321
|
+
clean_llm_ui($('#status'));
|
|
187
322
|
empty_model();
|
|
188
323
|
});
|
|
189
324
|
$(document).on('click','#generate_itext_button',function(e){
|
|
190
|
-
clean_llm_ui('status');
|
|
191
|
-
querying_llm_ui('status'
|
|
192
|
-
call_llm_text_service('status','prompt','llms','file');
|
|
325
|
+
clean_llm_ui($('#status'));
|
|
326
|
+
querying_llm_ui($('#status'),$('#llms'),'thinks');
|
|
327
|
+
call_llm_text_service($('#status'),'prompt','#llms','file');
|
|
193
328
|
});
|
|
194
329
|
$(document).on('click','#generate_text_button',function(e){
|
|
195
|
-
clean_llm_ui('status');
|
|
196
|
-
querying_llm_ui('status'
|
|
197
|
-
call_llm_text_service('status'
|
|
330
|
+
clean_llm_ui($('#status'));
|
|
331
|
+
querying_llm_ui($('#status'),$('#llms'),'thinks');
|
|
332
|
+
call_llm_text_service($('#status'),$('#prompt'),$('#llms'),'show');
|
|
198
333
|
});
|
|
199
334
|
$(document).on('click','#prompt_undo_button',function(e){
|
|
200
|
-
clean_llm_ui('status');
|
|
201
|
-
querying_llm_ui('status'
|
|
335
|
+
clean_llm_ui($('#status'));
|
|
336
|
+
querying_llm_ui($('#status'),$('#llms'),'thinks');
|
|
202
337
|
load_last_model_before_generation();
|
|
203
338
|
});
|
|
204
339
|
$(document).on('click','#prompt_attach_button',function(e){
|
|
205
340
|
document.getElementById('loadtxt').click();
|
|
206
341
|
});
|
|
342
|
+
$(document).on('click','#prompt_prop_button',function(e){
|
|
343
|
+
var menu = new CustomMenu(e);
|
|
344
|
+
|
|
345
|
+
var mode_entries = [];
|
|
346
|
+
$('#mode option').each(function(){
|
|
347
|
+
mode_entries.push({
|
|
348
|
+
label: $(this).text(),
|
|
349
|
+
menu_icon: $(this).is(':selected') ? mode_active : mode_inactive,
|
|
350
|
+
function_call: function(val){
|
|
351
|
+
$('#mode').val(val);
|
|
352
|
+
$('#mode option').removeAttr('selected');
|
|
353
|
+
$('#mode option[value="' + val + '"]').attr('selected', 'selected');
|
|
354
|
+
},
|
|
355
|
+
params: [$(this).val()]
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
var llm_entries = [];
|
|
360
|
+
$('#llms option').each(function(){
|
|
361
|
+
llm_entries.push({
|
|
362
|
+
label: $(this).text(),
|
|
363
|
+
menu_icon: $(this).is(':selected') ? llm_active : llm_inactive,
|
|
364
|
+
function_call: function(val){
|
|
365
|
+
$('#llms').val(val);
|
|
366
|
+
$('#llms option').removeAttr('selected');
|
|
367
|
+
$('#llms option[value="' + val + '"]').attr('selected', 'selected');
|
|
368
|
+
},
|
|
369
|
+
params: [$(this).val()]
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
menu.contextmenu({ 'Models': mode_entries, 'LLMs': llm_entries });
|
|
374
|
+
});
|
|
207
375
|
$("#loadtxt").change(function(e){
|
|
208
376
|
let files = document.getElementById('loadtxt').files;
|
|
209
377
|
load_file_content(files);
|
|
@@ -213,4 +381,4 @@ $(document).ready(function() {
|
|
|
213
381
|
e.stopPropagation();
|
|
214
382
|
load_file_content(e.originalEvent.dataTransfer.files);
|
|
215
383
|
});
|
|
216
|
-
});
|
|
384
|
+
}); //}}}
|
data/cockpit/js/parameters.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
var parameters_changed = new Event("parameters:changed", {"bubbles":true, "cancelable":false});
|
|
2
|
+
var attributes_changed = new Event("attributes:changed", {"bubbles":true, "cancelable":false});
|
|
3
|
+
var endpoints_changed = new Event("endpoints:changed", {"bubbles":true, "cancelable":false});
|
|
4
|
+
var dataelements_changed = new Event("dataelements:changed", {"bubbles":true, "cancelable":false});
|
|
2
5
|
|
|
3
6
|
$(document).ready(function() {
|
|
4
7
|
// hook up dataelements with relaxngui //{{{
|
|
@@ -63,19 +66,23 @@ $(document).ready(function() {
|
|
|
63
66
|
function do_parameters_save(event) { //{{{
|
|
64
67
|
var visid = $('ui-tabbar ui-tab',$(event.target).parents('ui-tabbed')).not('.switch').not('.inactive').attr('data-tab');
|
|
65
68
|
if (save[visid].has_changed()) {
|
|
66
|
-
var url = $('body').attr('current-instance');
|
|
67
69
|
save[visid].set_checkpoint();
|
|
68
|
-
var
|
|
70
|
+
var url = $('body').attr('current-instance');
|
|
69
71
|
document.dispatchEvent(parameters_changed);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
url: url + "/properties/" + visid + "/",
|
|
73
|
-
contentType: 'text/xml',
|
|
74
|
-
headers: {
|
|
75
|
-
'Content-ID': visid,
|
|
76
|
-
'CPEE-Event-Source': myid
|
|
77
|
-
},
|
|
78
|
-
data: send
|
|
79
|
-
});
|
|
72
|
+
document.dispatchEvent(eval(visid + '_changed'));
|
|
73
|
+
do_parameters_save_part(visid,save[visid].save_text());
|
|
80
74
|
}
|
|
81
75
|
} //}}}
|
|
76
|
+
|
|
77
|
+
function do_parameters_save_part(visid,send) { //{{{
|
|
78
|
+
$.ajax({
|
|
79
|
+
type: "PUT",
|
|
80
|
+
url: url + "/properties/" + visid + "/",
|
|
81
|
+
contentType: 'text/xml',
|
|
82
|
+
headers: {
|
|
83
|
+
'Content-ID': visid,
|
|
84
|
+
'CPEE-Event-Source': myid
|
|
85
|
+
},
|
|
86
|
+
data: send
|
|
87
|
+
});
|
|
88
|
+
} //}}}
|
data/cockpit/js/wfadaptor.js
CHANGED
|
@@ -278,17 +278,11 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
278
278
|
self.svg.defs[element] = sym;
|
|
279
279
|
}
|
|
280
280
|
} // }}}
|
|
281
|
-
this.set_svg_direct = function(svg) { // {{{
|
|
282
|
-
self.svg.container.append(svg);
|
|
283
|
-
let bb = svg[0].getBBox();
|
|
284
|
-
self.svg.container.attr('height', bb.y + bb.height + self.height_shift); // small border on the bottom
|
|
285
|
-
self.svg.container.attr('width', bb.x + bb.width + self.width_shift); // small border on the right
|
|
286
|
-
} // }}}
|
|
287
281
|
this.set_svg = function(graph) { // {{{
|
|
288
282
|
self.svg.container.append(graph.svg);
|
|
289
283
|
let bb = graph.svg[0].getBBox();
|
|
290
284
|
|
|
291
|
-
let w = self.dim.
|
|
285
|
+
let w = self.dim.get_x_max(0,graph.max.row,graph.max.col,'start');
|
|
292
286
|
if (w == 0) { w = bb.x + bb.width + self.width_shift; }
|
|
293
287
|
// the alternative is bb.x + bb.width + self.width_shift, but this is bad when clipped elements
|
|
294
288
|
|
|
@@ -444,7 +438,7 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
444
438
|
return mlen;
|
|
445
439
|
} //}}}
|
|
446
440
|
var get_x_plus = this.dim.get_x_plus = function(rowf,rowt,col,deb='') { //{{{
|
|
447
|
-
if (rowf<0) {
|
|
441
|
+
if (rowf<0) { rowf = 0 };
|
|
448
442
|
|
|
449
443
|
mlen = 0;
|
|
450
444
|
for (let i=rowf; i<=rowt; i++) {
|
|
@@ -455,6 +449,20 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
|
455
449
|
// console.log(deb,rowf,rowt,col,'--> ' + mlen,debug_dim());
|
|
456
450
|
return mlen;
|
|
457
451
|
} //}}}
|
|
452
|
+
var get_x_max = this.dim.get_x_max = function(rowf,rowt,colt,deb='') { //{{{
|
|
453
|
+
if (rowf<0) { rowf = 0 };
|
|
454
|
+
|
|
455
|
+
mlen = 0;
|
|
456
|
+
for (let i=rowf; i<=rowt; i++) {
|
|
457
|
+
for (let j=0; j<=colt; j++) {
|
|
458
|
+
if (self.dim.symbols[i] && self.dim.symbols[i][j] && mlen < self.dim.symbols[i][j].x + self.dim.symbols[i][j].width) {
|
|
459
|
+
mlen = self.dim.symbols[i][j].x + self.dim.symbols[i][j].width;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// console.log(deb,rowf,rowt,colt,'--> ' + mlen,debug_dim());
|
|
464
|
+
return mlen;
|
|
465
|
+
} //}}}
|
|
458
466
|
var get_x_width = this.dim.get_x_width = function(maxcol) { //{{{
|
|
459
467
|
let cwidth = 0;
|
|
460
468
|
for (let i=0; i < self.dim.symbols.length; i++) {
|
|
@@ -849,7 +857,9 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
849
857
|
var self = this;
|
|
850
858
|
var adaptor;
|
|
851
859
|
var illustrator;
|
|
860
|
+
var used_id_list = [];
|
|
852
861
|
var description;
|
|
862
|
+
var orig_description;
|
|
853
863
|
var id_counter = {};
|
|
854
864
|
var update_illustrator = true;
|
|
855
865
|
var labels = [];
|
|
@@ -875,6 +885,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
875
885
|
alert("WfDescription: unknown description type:\nConstructor-Name: " + desc.constructor + " / TypeOf: " + (typeof desc));
|
|
876
886
|
description = null;
|
|
877
887
|
}
|
|
888
|
+
orig_description = $($X(description.serializeXML()).get(0).ownerDocument);
|
|
878
889
|
id_counter = {};
|
|
879
890
|
labels = [];
|
|
880
891
|
let start = performance.now();
|
|
@@ -910,6 +921,11 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
910
921
|
var context_eval = this.context_eval = function(what) { // {{{
|
|
911
922
|
return eval(what);
|
|
912
923
|
} // }}}
|
|
924
|
+
|
|
925
|
+
var reset_used_id_list = this.reset_used_id_list = function() { // {{{
|
|
926
|
+
console.log('bbbbb');
|
|
927
|
+
used_id_list = [];
|
|
928
|
+
} // }}}
|
|
913
929
|
var get_free_id = this.get_free_id = function(prefix,aname,other) { // {{{
|
|
914
930
|
var existing = new Array();
|
|
915
931
|
if (other) {
|
|
@@ -925,6 +941,10 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
925
941
|
while ($.inArray(prefix + id,existing) != -1) {
|
|
926
942
|
id += 1;
|
|
927
943
|
}
|
|
944
|
+
while ($.inArray(prefix + id,used_id_list) != -1) {
|
|
945
|
+
id += 1;
|
|
946
|
+
}
|
|
947
|
+
used_id_list.push(prefix + id);
|
|
928
948
|
return prefix + id;
|
|
929
949
|
} // }}}
|
|
930
950
|
var refresh = this.refresh = function(doit) {
|
|
@@ -932,7 +952,8 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
932
952
|
labels = [];
|
|
933
953
|
let start = performance.now();
|
|
934
954
|
illustrator.clear();
|
|
935
|
-
|
|
955
|
+
clean_description();
|
|
956
|
+
var graph = parse(description.children('description').get(0), {'row':0,'col':0,final:false,wide:false});
|
|
936
957
|
illustrator.set_svg(graph);
|
|
937
958
|
self.set_labels(graph);
|
|
938
959
|
illustrator.set_duration(start);
|
|
@@ -940,9 +961,10 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
940
961
|
}
|
|
941
962
|
var redraw = this.redraw = function(){
|
|
942
963
|
id_counter = {};
|
|
943
|
-
labels = [];
|
|
944
964
|
let start = performance.now();
|
|
965
|
+
labels = [];
|
|
945
966
|
illustrator.clear();
|
|
967
|
+
clean_description();
|
|
946
968
|
var graph = parse(description.children('description').get(0), {'row':0,'col':0,final:false,wide:false});
|
|
947
969
|
illustrator.set_svg(graph);
|
|
948
970
|
self.set_labels(graph);
|
|
@@ -954,7 +976,8 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
954
976
|
let start = performance.now();
|
|
955
977
|
labels = [];
|
|
956
978
|
illustrator.clear();
|
|
957
|
-
|
|
979
|
+
clean_description();
|
|
980
|
+
var graph = parse(description.children('description').get(0), {'row':0,'col':0,final:false,wide:false});
|
|
958
981
|
illustrator.set_svg(graph);
|
|
959
982
|
self.set_labels(graph);
|
|
960
983
|
illustrator.set_duration(start);
|
|
@@ -1033,6 +1056,20 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1033
1056
|
// }}}
|
|
1034
1057
|
// }}}
|
|
1035
1058
|
// Helper Functions {{{
|
|
1059
|
+
var clean_description = function() { // private {{{
|
|
1060
|
+
$('*[svg-id]',description).each(function(){
|
|
1061
|
+
$(this).removeAttr('svg-id');
|
|
1062
|
+
});
|
|
1063
|
+
$('*[svg-type]',description).each(function(){
|
|
1064
|
+
$(this).removeAttr('svg-type');
|
|
1065
|
+
});
|
|
1066
|
+
$('*[svg-subtype]',description).each(function(){
|
|
1067
|
+
$(this).removeAttr('svg-subtype');
|
|
1068
|
+
});
|
|
1069
|
+
$('*[svg-label]',description).each(function(){
|
|
1070
|
+
$(this).removeAttr('svg-label');
|
|
1071
|
+
});
|
|
1072
|
+
} //}}}
|
|
1036
1073
|
var parse = function(root, parent_pos) { // private {{{
|
|
1037
1074
|
var pos = JSON.parse(JSON.stringify(parent_pos));
|
|
1038
1075
|
var max = {'row': 0,'col': 0};
|
|
@@ -1298,7 +1335,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
|
1298
1335
|
// }}}
|
|
1299
1336
|
|
|
1300
1337
|
///////// show graph step by step
|
|
1301
|
-
// illustrator.
|
|
1338
|
+
// illustrator.set_svg(block);
|
|
1302
1339
|
// debugger;
|
|
1303
1340
|
|
|
1304
1341
|
return [g, endnodes];
|