FCLT#80553 niet de hele XML meegeven maar een samengestelde JSON
svn path=/Website/trunk/; revision=64769
This commit is contained in:
@@ -1635,6 +1635,56 @@ mld = {
|
||||
return trackarray;
|
||||
},
|
||||
|
||||
getmldjson: // Geef onderwerp, omschrijving en notities terug als JSON object
|
||||
function(mld_key)
|
||||
{
|
||||
var json_result = {
|
||||
notities: []
|
||||
};
|
||||
var sql = "SELECT m.mld_melding_onderwerp,"
|
||||
+ " TO_CHAR (SUBSTR (m.mld_melding_omschrijving, 1, 4000))"
|
||||
+ " mld_melding_omschrijving,"
|
||||
+ " s.mld_stdmelding_omschrijving,"
|
||||
+ " d.ins_discipline_omschrijving,"
|
||||
+ " t.ins_srtdiscipline_omschrijving"
|
||||
+ " FROM mld_melding m,"
|
||||
+ " mld_stdmelding s,"
|
||||
+ " mld_discipline d,"
|
||||
+ " ins_srtdiscipline t"
|
||||
+ " WHERE m.mld_melding_key = " + mld_key
|
||||
+ " AND m.mld_stdmelding_key = s.mld_stdmelding_key"
|
||||
+ " AND s.mld_ins_discipline_key = d.ins_discipline_key"
|
||||
+ " AND d.ins_srtdiscipline_key = t.ins_srtdiscipline_key";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.EoF) {
|
||||
json_result.type = oRs("ins_srtdiscipline_omschrijving").Value;
|
||||
json_result.categorie = oRs("ins_discipline_omschrijving").Value;
|
||||
json_result.melding = oRs("mld_stdmelding_omschrijving").Value;
|
||||
json_result.onderwerp = oRs("mld_melding_onderwerp").Value;
|
||||
json_result.omschrijving = oRs("mld_melding_omschrijving").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
sql = "SELECT COALESCE (mld_melding_note_wijzigdatum, mld_melding_note_aanmaak) datum,"
|
||||
+ " mn.mld_melding_note_omschrijving,"
|
||||
+ " p.prs_perslid_naam_friendly"
|
||||
+ " FROM mld_melding_note mn"
|
||||
+ " , prs_v_perslid_fullnames p"
|
||||
+ " WHERE mn.prs_perslid_key = p.prs_perslid_key" // Geen outer-join want we willen hier geen tracking
|
||||
+ " AND mld_melding_key = " + mld_key
|
||||
+ " ORDER BY mld_melding_note_aanmaak ASC";
|
||||
oRs = Oracle.Execute(sql);
|
||||
while (!oRs.EoF) {
|
||||
json_result.notities.push({
|
||||
datum: new Date(oRs("datum").Value),
|
||||
omschrijving: oRs("mld_melding_note_omschrijving").Value,
|
||||
naam: oRs("prs_perslid_naam_friendly").Value
|
||||
});
|
||||
oRs.MoveNext();
|
||||
}
|
||||
oRs.Close();
|
||||
return json_result;
|
||||
},
|
||||
|
||||
getStatusSql:
|
||||
function(mldstatus_str, alias)
|
||||
{
|
||||
@@ -7536,9 +7586,7 @@ mld = {
|
||||
+ " WHERE k.prs_kostenplaats_key = o.prs_kostenplaats_key) kpstring"
|
||||
+ " , o.mld_opdr_key"
|
||||
+ " , o.mld_opdr_flag"
|
||||
+ (S("mld_opdr_actiecode") == 1
|
||||
? " , o.mld_opdr_actiecode"
|
||||
: "")
|
||||
+ " , o.mld_opdr_actiecode"
|
||||
+ " , c.cnt_contract_key"
|
||||
+ " , c.cnt_contract_nummer"
|
||||
+ " , c.cnt_contract_nummer_intern"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<!-- #include file="../Shared/iface.inc" -->
|
||||
<!-- #include file="../Shared/disciplineselector.inc" -->
|
||||
<!-- #include file="../Shared/selector.inc" -->
|
||||
<!-- #include file="../Shared/xml_converter.inc" -->
|
||||
|
||||
<%
|
||||
FCLTHeader.Requires({ plugins: ["jQuery"],
|
||||
@@ -67,8 +66,8 @@ var authparams = user.checkAutorisation("WEB_FAQFOF");
|
||||
var sgQuestion = "";
|
||||
var sgAnswer = "";
|
||||
if (S("ai_enabled") & 2) {
|
||||
var xml = make_xml({ xmlnode: "melding", key: mld_key });
|
||||
var result = shared.promptAI(xml, { "instructions": L("lcl_mld_ai_faq_instructions"), "response_format": "json_object" });
|
||||
var json = mld.getmldjson(mld_key);
|
||||
var result = shared.promptAI(JSON.stringify(json), { "instructions": L("lcl_mld_ai_faq_instructions"), "response_format": "json_object" });
|
||||
if (result.success) {
|
||||
try {
|
||||
var content = JSON.parse(result.content);
|
||||
|
||||
@@ -24,7 +24,6 @@ if (mld_key_arr.length)
|
||||
<!-- #include file="../ins/ins.inc" -->
|
||||
<!-- #include file="mld_flexkenmerk.inc" -->
|
||||
<!-- #include file="mld.inc" -->
|
||||
<!-- #include file="../Shared/xml_converter.inc" -->
|
||||
<%
|
||||
|
||||
FCLTHeader.Requires({ plugins: ["suggest", "jQuery", "kenmerk"] });
|
||||
@@ -448,8 +447,8 @@ for (var i = 2; i >= 0; i--)
|
||||
|
||||
var afmeldtext = "";
|
||||
if (ingesloten.length == 1 && (S("ai_enabled") & 4)) {
|
||||
var xml = make_xml({ xmlnode: "melding", key: ingesloten[0] });
|
||||
var result = shared.promptAI(xml, { "instructions": L("lcl_mld_ai_afmeldtekst_instructions") });
|
||||
var json = mld.getmldjson(ingesloten[0]);
|
||||
var result = shared.promptAI(JSON.stringify(json), { "instructions": L("lcl_mld_ai_afmeldtekst_instructions") });
|
||||
if (result.success) {
|
||||
afmeldtext = result.content;
|
||||
}
|
||||
|
||||
@@ -670,7 +670,9 @@ var shared = {
|
||||
params.model = S("openai_model_large_context");
|
||||
return shared.promptAI(msg, params);
|
||||
}
|
||||
result.warning = "[" + http.status + "] - OpenAI [" + openAIresponse.error.code + "] - " + openAIresponse.error.message;
|
||||
result.warning = "[" + http.status + "] - OpenAI"
|
||||
+ (openAIresponse.error.code ? " [" + openAIresponse.error.code + "]" : "")
|
||||
+ " - " + openAIresponse.error.message;
|
||||
__DoLog(result.warning, "#FF0000");
|
||||
__DoLog(body);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user