Prevent citations in clinical image prompts
This commit is contained in:
parent
604f6abb49
commit
cf90d80f34
2 changed files with 4 additions and 6 deletions
|
|
@ -282,13 +282,11 @@ async function imageSourceToBlob(src) {
|
|||
return response.blob();
|
||||
}
|
||||
|
||||
export function buildContextualImagePrompt(request, lastAnswer, lastSources) {
|
||||
export function buildContextualImagePrompt(request, lastAnswer) {
|
||||
var prompt = String(request || '').trim();
|
||||
if (!lastAnswer) return prompt;
|
||||
var sourceText = (lastSources || []).slice(0, 6).map(function (s, idx) {
|
||||
return '[' + (s.number || idx + 1) + '] ' + (s.title || s.resource || 'Source') + (s.page ? ', page ' + s.page : '');
|
||||
}).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;
|
||||
var answer = String(lastAnswer || '').replace(/\[\d+(?:\s*,\s*\d+)*\]/g, '').slice(0, 3000);
|
||||
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;
|
||||
}
|
||||
|
||||
export function isImageRequest(text) {
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ import {
|
|||
|
||||
function prepareSidebarImagePrompt(request) {
|
||||
var promptEl = document.getElementById('assistant-image-prompt');
|
||||
var prompt = buildContextualImagePrompt(request, lastAnswer, lastSources);
|
||||
var prompt = buildContextualImagePrompt(request, lastAnswer);
|
||||
if (promptEl) {
|
||||
promptEl.value = prompt;
|
||||
promptEl.focus();
|
||||
|
|
|
|||
Loading…
Reference in a new issue