mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
Temperature parameters can be customized (#1162)
* Temperature parameters can be customized * fix typo * update to 1.105.22 * Update index.html
This commit is contained in:
parent
91dc16878e
commit
ca8e723006
4 changed files with 26 additions and 8 deletions
15
index.html
15
index.html
|
|
@ -4951,7 +4951,18 @@
|
|||
>Model:
|
||||
<select id="aiGeneratorModel"></select>
|
||||
</label>
|
||||
|
||||
<label for="aiGeneratorTemperature"
|
||||
>Temperature:
|
||||
<input id="aiGeneratorTemperature" type="number" min="0" max="2" placeholder="1.2" class="icon-key" />
|
||||
<a
|
||||
href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-temperature"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
class="icon-help-circled"
|
||||
style="text-decoration: none"
|
||||
data-tip="Between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
|
||||
></a>
|
||||
</label>
|
||||
<label for="aiGeneratorKey"
|
||||
>Key:
|
||||
<input id="aiGeneratorKey" placeholder="Enter OpenAI API key" class="icon-key" />
|
||||
|
|
@ -8098,7 +8109,7 @@
|
|||
<script defer src="modules/ui/burg-editor.js?v=1.102.00"></script>
|
||||
<script defer src="modules/ui/units-editor.js?v=1.104.0"></script>
|
||||
<script defer src="modules/ui/notes-editor.js?v=1.99.06"></script>
|
||||
<script defer src="modules/ui/ai-generator.js?v=1.99.09"></script>
|
||||
<script defer src="modules/ui/ai-generator.js?v=1.105.22"></script>
|
||||
<script defer src="modules/ui/diplomacy-editor.js?v=1.99.00"></script>
|
||||
<script defer src="modules/ui/zones-editor.js?v=1.105.20"></script>
|
||||
<script defer src="modules/ui/burgs-overview.js?v=1.105.15"></script>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
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) {
|
||||
function generateWithAi(defaultPrompt, onApply) {
|
||||
updateValues();
|
||||
|
||||
$("#aiGenerator").dialog({
|
||||
|
|
@ -26,13 +26,14 @@ function geneateWithAi(defaultPrompt, onApply) {
|
|||
}
|
||||
});
|
||||
|
||||
if (modules.geneateWithAi) return;
|
||||
modules.geneateWithAi = true;
|
||||
if (modules.generateWithAi) return;
|
||||
modules.generateWithAi = true;
|
||||
|
||||
function updateValues() {
|
||||
byId("aiGeneratorResult").value = "";
|
||||
byId("aiGeneratorPrompt").value = defaultPrompt;
|
||||
byId("aiGeneratorKey").value = localStorage.getItem("fmg-ai-kl") || "";
|
||||
byId("aiGeneratorTemperature").value = localStorage.getItem("fmg-ai-temperature") || "1.2";
|
||||
|
||||
const select = byId("aiGeneratorModel");
|
||||
select.options.length = 0;
|
||||
|
|
@ -52,6 +53,12 @@ function geneateWithAi(defaultPrompt, onApply) {
|
|||
const prompt = byId("aiGeneratorPrompt").value;
|
||||
if (!prompt) return tip("Please enter a prompt", true, "error", 4000);
|
||||
|
||||
const temperature = parseFloat(byId("aiGeneratorTemperature").value);
|
||||
if (isNaN(temperature) || temperature < 0 || temperature > 2) {
|
||||
return tip("Temperature must be a number between 0 and 2", true, "error", 4000);
|
||||
}
|
||||
localStorage.setItem("fmg-ai-temperature", temperature.toString());
|
||||
|
||||
try {
|
||||
button.disabled = true;
|
||||
const resultArea = byId("aiGeneratorResult");
|
||||
|
|
@ -70,7 +77,7 @@ function geneateWithAi(defaultPrompt, onApply) {
|
|||
{role: "system", content: SYSTEM_MESSAGE},
|
||||
{role: "user", content: prompt}
|
||||
],
|
||||
temperature: 1.2,
|
||||
temperature: temperature,
|
||||
stream: true // Enable streaming
|
||||
})
|
||||
});
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ function editNotes(id, name) {
|
|||
}
|
||||
};
|
||||
|
||||
geneateWithAi(prompt, onApply);
|
||||
generateWithAi(prompt, onApply);
|
||||
}
|
||||
|
||||
function downloadLegends() {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
||||
*/
|
||||
|
||||
const VERSION = "1.105.21";
|
||||
const VERSION = "1.105.22";
|
||||
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue