From ab32a8a82f0e4971c1733de96f79f20d89eb6db3 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 23 Aug 2024 15:52:52 +0200 Subject: [PATCH] feat - ai generation - improve prompt --- modules/ui/ai-generator.js | 3 ++- modules/ui/notes-editor.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ui/ai-generator.js b/modules/ui/ai-generator.js index a181ff7a..a0dbc0a6 100644 --- a/modules/ui/ai-generator.js +++ b/modules/ui/ai-generator.js @@ -1,6 +1,7 @@ "use strict"; const GPT_MODELS = ["gpt-4o-mini", "chatgpt-4o-latest", "gpt-4o", "gpt-4-turbo", "gpt-4", "gpt-3.5-turbo"]; +const SYSTEM_MESSAGE = "I'm working on my fantasy map."; function geneateWithAi(defaultPrompt, onApply) { updateValues(); @@ -61,7 +62,7 @@ function geneateWithAi(defaultPrompt, onApply) { body: JSON.stringify({ model, messages: [ - {role: "system", content: "I'm working on my fantasy map"}, + {role: "system", content: SYSTEM_MESSAGE}, {role: "user", content: prompt} ], temperature: 1.2 diff --git a/modules/ui/notes-editor.js b/modules/ui/notes-editor.js index a051c6c3..378cec3c 100644 --- a/modules/ui/notes-editor.js +++ b/modules/ui/notes-editor.js @@ -147,9 +147,9 @@ function editNotes(id, name) { function openAiGenerator() { const note = notes.find(note => note.id === notesSelect.value); - let prompt = `Respond with detailed description. Format to html, respond with content div. Remove h tags. Use simple dry language. Invent facts, names and details.`; + let prompt = `Respond with description. Use simple dry language. Invent facts, names and details. Split to paragraphs and format to HTML. Remove h tags, remove markdown.`; if (note?.name) prompt += ` Name: ${note.name}.`; - if (note?.legend) prompt += ` Embed data: ${note.legend}`; + if (note?.legend) prompt += ` Data: ${note.legend}`; const onApply = result => { notesLegend.innerHTML = result;