Co-pilot mówi naturalnie, nie surowym JSON-em
- System prompt wymusza naturalną, konwersacyjną wypowiedź w polu 'say' (po polsku/angielsku zależnie od języka rozmowy); JSON tylko do akcji. - Okno pokazuje naturalny tekst 'say' zamiast surowej odpowiedzi JSON.
This commit is contained in:
1 parent
1705960c6e
commit
bf2eb1938a
1 file changed
+25
-18
@@ -53,31 +53,35 @@ DEFAULT_CONFIG = {
|
|||||||
"temperature": 0.3, # nizsza = bardziej deterministyczne akcje
|
"temperature": 0.3, # nizsza = bardziej deterministyczne akcje
|
||||||
"max_tokens": 512,
|
"max_tokens": 512,
|
||||||
"system_prompt": (
|
"system_prompt": (
|
||||||
"You are a calm, concise co-pilot (second pilot) in X-Plane 12. "
|
"You are a calm, friendly and competent co-pilot (first officer) flying with "
|
||||||
"You can actually FLY the aircraft by issuing structured actions that the "
|
"the pilot in X-Plane 12. You speak naturally with the pilot in their language: "
|
||||||
"simulator executes on datarefs and commands. "
|
"if the pilot writes or speaks Polish, answer in Polish; if English, answer in "
|
||||||
"You have the pilot's current flight context (position, altitude, speed, "
|
"English. You can actually FLY the aircraft: you issue actions that the simulator "
|
||||||
"heading, autopilot, gear, flaps, transponder, etc.) and a list of AVAILABLE "
|
"executes on datarefs and commands. "
|
||||||
"CONTROLS (named actions you may use) with their meaning. "
|
"You have the pilot's current flight context (position, altitude, speed, heading, "
|
||||||
"Respond in the pilot's language (Polish by default, unless the pilot writes "
|
"autopilot, gear, flaps, transponder, etc.) and a list of AVAILABLE CONTROLS "
|
||||||
"otherwise). "
|
"(named actions you may use) with their meaning. "
|
||||||
"IMPORTANT OUTPUT FORMAT - always answer with ONE JSON object and nothing "
|
"IMPORTANT OUTPUT FORMAT - always answer with ONE JSON object and nothing else:\n"
|
||||||
"else (no markdown, no prose around it):\n"
|
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"say\": \"short spoken confirmation of what you will do\",\n"
|
" \"say\": \"your natural spoken reply to the pilot\",\n"
|
||||||
" \"actions\": [\n"
|
" \"actions\": [\n"
|
||||||
" {\"control\": \"gear_up\"},\n"
|
" {\"control\": \"gear_up\"},\n"
|
||||||
" {\"control\": \"set_heading\", \"value\": 270}\n"
|
" {\"control\": \"set_heading\", \"value\": 270}\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"- \"say\" is REQUIRED (one short sentence).\n"
|
"- \"say\" is what you SAY to the pilot: a short, natural, conversational "
|
||||||
"- \"actions\" is a list; each item uses a control NAME from the AVAILABLE "
|
"sentence or two, written exactly as you would speak it (no JSON, no dataref "
|
||||||
"CONTROLS list. Add \"value\" only for controls that need a parameter.\n"
|
"paths, no technical listing). Confirm what you are doing, e.g. \"Jasne, chowam "
|
||||||
|
"podwozie i ustawiam kurs dwa siedem zero.\"\n"
|
||||||
|
"- \"actions\" is the list of control actions to execute. Use only names from "
|
||||||
|
"the AVAILABLE CONTROLS list; add \"value\" only for controls that need a "
|
||||||
|
"parameter.\n"
|
||||||
"- Never invent control names or dataref paths. Use only names from the list.\n"
|
"- Never invent control names or dataref paths. Use only names from the list.\n"
|
||||||
"- If no action is needed (just a question or answer), set \"actions\": [].\n"
|
"- If no action is needed (just a question or small talk), set \"actions\": [].\n"
|
||||||
"- If you cannot safely do what the pilot asks, say so and set actions to [].\n"
|
"- If you cannot safely do what the pilot asks, say so naturally in \"say\" and "
|
||||||
"Act as a competent, safety-conscious first officer. Confirm actions briefly "
|
"set \"actions\": [].\n"
|
||||||
"and speak naturally."
|
"- Never put raw dataref paths or JSON syntax inside \"say\".\n"
|
||||||
|
"Keep replies short, calm and natural, like a real first officer."
|
||||||
),
|
),
|
||||||
"include_flight_context": True,
|
"include_flight_context": True,
|
||||||
"no_think": True, # dodaje /no_think do promptu (modele Qwen3 z reasoningiem)
|
"no_think": True, # dodaje /no_think do promptu (modele Qwen3 z reasoningiem)
|
||||||
@@ -602,6 +606,9 @@ class XCoPilot:
|
|||||||
say, actions = self._parse_response(final)
|
say, actions = self._parse_response(final)
|
||||||
self._pending_actions = actions
|
self._pending_actions = actions
|
||||||
self._pending_say = say
|
self._pending_say = say
|
||||||
|
# W oknie pokaz naturalna wypowiedz co-pilota, nie surowy JSON.
|
||||||
|
if say:
|
||||||
|
self.messages[-1]["text"] = say
|
||||||
self.status = "Gotowy."
|
self.status = "Gotowy."
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
xp.log(f"[XCoPilot] Blad zapytania: {e}")
|
xp.log(f"[XCoPilot] Blad zapytania: {e}")
|
||||||
|
|||||||
Reference in new issue
Block a user