Added personality to describe reply
This commit is contained in:
parent
3ea09af486
commit
2fbb34e4c7
2 changed files with 13 additions and 2 deletions
|
|
@ -151,7 +151,8 @@
|
|||
var teaser = data.teaser || '';
|
||||
var rawFirst = (Array.isArray(data.raw_json) && data.raw_json.length) ? data.raw_json[0] : data.raw_json;
|
||||
var quoteDa = data.quote_da || (rawFirst && rawFirst.quote_da) || '';
|
||||
showModal(job, articleId, desc, teaser, quoteDa, data.raw_json || null);
|
||||
var personality = data.personality || (rawFirst && rawFirst.personality) || '';
|
||||
showModal(job, articleId, desc, teaser, quoteDa, personality, data.raw_json || null);
|
||||
} else {
|
||||
var msg = (data && data.message) ? data.message : 'No response';
|
||||
if (data && data.log) {
|
||||
|
|
@ -173,7 +174,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function showModal(job, articleId, description, teaser, quoteDa, rawJson){
|
||||
function showModal(job, articleId, description, teaser, quoteDa, personality, rawJson){
|
||||
var existing = document.getElementById('mvlog-gemini-modal');
|
||||
if (existing) existing.remove();
|
||||
var overlay = document.createElement('div');
|
||||
|
|
@ -183,6 +184,12 @@
|
|||
box.style.cssText = 'background:white;color:#111;padding:20px;max-width:900px;max-height:80vh;overflow:auto;border-radius:6px;font-family:inherit;';
|
||||
var h = document.createElement('h3');
|
||||
h.textContent = 'Generated description';
|
||||
var personalityBox = null;
|
||||
if (personality) {
|
||||
personalityBox = document.createElement('div');
|
||||
personalityBox.style.cssText = 'font-size:0.9rem;color:#555;margin-top:6px;';
|
||||
personalityBox.textContent = 'Personality: ' + personality;
|
||||
}
|
||||
var teaserBox = null;
|
||||
if (teaser) {
|
||||
teaserBox = document.createElement('div');
|
||||
|
|
@ -210,6 +217,7 @@
|
|||
btnBar.appendChild(useBtn);
|
||||
btnBar.appendChild(cancelBtn);
|
||||
box.appendChild(h);
|
||||
if (personalityBox) box.appendChild(personalityBox);
|
||||
if (teaserBox) box.appendChild(teaserBox);
|
||||
box.appendChild(pre);
|
||||
if (quoteBox) box.appendChild(quoteBox);
|
||||
|
|
|
|||
|
|
@ -169,12 +169,14 @@ if (is_file($gfile)) {
|
|||
$description = '';
|
||||
$teaser = '';
|
||||
$quote_da = '';
|
||||
$personality = '';
|
||||
$tags = [];
|
||||
if (is_array($json)) {
|
||||
$description = isset($json['description']) ? (string)$json['description'] : '';
|
||||
$teaser = isset($json['teaser']) ? (string)$json['teaser'] : '';
|
||||
$quote_da = isset($json['quote_da']) ? (string)$json['quote_da'] : '';
|
||||
$quote_da = trim($quote_da, "\"“”");
|
||||
$personality = isset($json['personality']) ? (string)$json['personality'] : '';
|
||||
$tags = isset($json['tags']) && is_array($json['tags']) ? $json['tags'] : [];
|
||||
}
|
||||
|
||||
|
|
@ -183,6 +185,7 @@ if (is_file($gfile)) {
|
|||
'description' => $description,
|
||||
'teaser' => $teaser,
|
||||
'quote_da' => $quote_da,
|
||||
'personality' => $personality,
|
||||
'tags' => $tags,
|
||||
'raw_json' => $json_data, // Send original raw data back for reference
|
||||
'log' => $log,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue