Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演
JavaScript ai-artai-videochrome-extensionclaude-codecodexhiggsfieldjimenglocal-firstmcpmidjourneymoodboardprompt-engineeringprompt-libraryprompt-managerreference-libraryseedancevisual-bookmarksweb-clipper
import { showAppDialog } from './ui-dialogs.js';
// Reuse the existing application dialog, leaving the library detail intact.
export async function sendWithGenerationPromptConfirmation(message, { send = value => chrome.runtime.sendMessage(value) } = {}) {
const choices = { ...(message.generationPromptChoices ?? {}) };
while (true) {
const response = await send({ ...message, generationPromptChoices: choices });
if (!response?.promptConflicts?.length) return response;
for (const conflict of response.promptConflicts) {
const answer = await showAppDialog({
title: '原始提示词有冲突', description: conflict.name,
confirmLabel: '覆盖', cancelLabel: '跳过',
renderBody({ body }) {
for (const [label, value] of [['已有原始提示词', conflict.originalText], ['图片内嵌提示词', conflict.embeddedText]]) {
const heading = document.createElement('h3'); heading.textContent = label;
const content = document.createElement('pre'); content.className = 'prompt-text'; content.textContent = value;
// Confirmation must expose the complete text, including long prompts.
content.style.maxHeight = 'none';
body.append(heading, content);
}
}
});
choices[conflict.token] = answer !== null ? 'overwrite' : 'skip';
}
}
}