This commit is contained in:
2026-05-14 19:11:10 +02:00
parent 2d4002bd3f
commit 52ad83a96d
15 changed files with 169 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
extends Node
const OLLAMA_URL: String = "http://127.0.0.1:11434/api/generate"
const DEFAULT_MODEL: String = "qwen2.5:0.5b"
const DEFAULT_MODEL: String = "mistral-nemo"
const REQUEST_TIMEOUT: float = 25.0
var _http: HTTPRequest
@@ -19,8 +19,9 @@ func ask(npc: Node, player: Node, question: String) -> void:
request_ask.rpc_id(1, npc.get_path(), player.get_path(), question)
return
var profile: NpcProfile = npc.profile
var system_prompt: String = "Du bist %s, eine NPC in einem mittelalterlichen Dorf. Lore: %s. Persönlichkeit: %s. Antworte knapp (max 2 Sätze) auf Deutsch und bleibe immer in deiner Rolle. Erfinde keine Fakten über die Welt." % [profile.display_name, profile.lore, profile.personality]
var prompt: String = "Spieler: %s\n%s:" % [question, profile.display_name]
var world_context: String = GameLore.build_npc_context(profile)
var system_prompt: String = "%s\n\nDU BIST:\nName: %s\nHintergrund: %s\nPersönlichkeit: %s\n\nREGELN:\n- Antworte kurz: maximal 2 Sätze.\n- Antworte auf Deutsch.\n- Bleibe in deiner Rolle, schreibe NIE 'Als KI...' oder Ähnliches.\n- Nutze die WELT-Begriffe (Schlund, Atemzug, Reisender, Anker, Anderseite).\n- Wenn dich etwas gefragt wird, das du nicht wissen kannst, sag das ehrlich.\n- Erfinde keine Fakten, die nicht in der WELT stehen." % [world_context, profile.display_name, profile.lore, profile.personality]
var prompt: String = "Reisender: %s\n%s:" % [question, profile.display_name]
_send_request(npc, player, system_prompt, prompt)
@rpc("any_peer", "reliable")