Prevent citations in clinical image prompts
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 1m58s
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 1m58s
This commit is contained in:
parent
604f6abb49
commit
c88cc6a547
2 changed files with 4 additions and 6 deletions
|
|
@ -282,13 +282,11 @@ async function imageSourceToBlob(src) {
|
||||||
return response.blob();
|
return response.blob();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildContextualImagePrompt(request, lastAnswer, lastSources) {
|
export function buildContextualImagePrompt(request, lastAnswer) {
|
||||||
var prompt = String(request || '').trim();
|
var prompt = String(request || '').trim();
|
||||||
if (!lastAnswer) return prompt;
|
if (!lastAnswer) return prompt;
|
||||||
var sourceText = (lastSources || []).slice(0, 6).map(function (s, idx) {
|
var answer = String(lastAnswer || '').replace(/\[\d+(?:\s*,\s*\d+)*\]/g, '').slice(0, 3000);
|
||||||
return '[' + (s.number || idx + 1) + '] ' + (s.title || s.resource || 'Source') + (s.page ? ', page ' + s.page : '');
|
return prompt + '\n\nUse this clinical answer as the required context. Do not switch topics or introduce unrelated scenes such as gardening. Create a medical teaching visual faithful to the answer. Do not include citations, reference numbers, footnotes, source lists, or named organizations; do not invent references.\n\nAnswer:\n' + answer;
|
||||||
}).join('\n');
|
|
||||||
return prompt + '\n\nUse this clinical answer as the required context. Do not switch topics or introduce unrelated scenes such as gardening. Create a medical teaching visual faithful to the answer.\n\nAnswer:\n' + String(lastAnswer || '').slice(0, 3000) + '\n\nSources:\n' + sourceText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isImageRequest(text) {
|
export function isImageRequest(text) {
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,7 @@ import {
|
||||||
|
|
||||||
function prepareSidebarImagePrompt(request) {
|
function prepareSidebarImagePrompt(request) {
|
||||||
var promptEl = document.getElementById('assistant-image-prompt');
|
var promptEl = document.getElementById('assistant-image-prompt');
|
||||||
var prompt = buildContextualImagePrompt(request, lastAnswer, lastSources);
|
var prompt = buildContextualImagePrompt(request, lastAnswer);
|
||||||
if (promptEl) {
|
if (promptEl) {
|
||||||
promptEl.value = prompt;
|
promptEl.value = prompt;
|
||||||
promptEl.focus();
|
promptEl.focus();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue