v2.1.1: fix developer role mapping for DeepSeek and other providers

This commit is contained in:
admin
2026-05-19 17:12:07 +04:00
Unverified
parent 772255a188
commit ccc3054793
5 changed files with 26 additions and 2 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## v2.1.1 (2026-05-19)
- Fixed proxy: map `developer` role to `system` for Chat Completions providers (DeepSeek, Qwen, etc.)
- Fixed proxy: map `developer` role to `user` for Anthropic providers
- Forward `instructions` field from Responses API as system message/param
- Fixes "unknown variant `developer`" error from providers like DeepSeek
## v2.1.0 (2026-05-19) ## v2.1.0 (2026-05-19)
- Added Codex auth status detection (reads `codex login status`) - Added Codex auth status detection (reads `codex login status`)

Binary file not shown.

Binary file not shown.

View File

@@ -24,6 +24,12 @@ model_catalog_json = ""
""" """
CHANGELOG = [ CHANGELOG = [
("2.1.1", "2026-05-19", [
"Fixed proxy: map 'developer' role to 'system' for Chat Completions providers",
"Fixed proxy: map 'developer' role to 'user' for Anthropic providers",
"Forward 'instructions' field from Responses API as system message/param",
"Fixes DeepSeek and other providers rejecting unknown 'developer' role",
]),
("2.1.0", "2026-05-19", [ ("2.1.0", "2026-05-19", [
"Added Codex auth status detection (codex login status)", "Added Codex auth status detection (codex login status)",
"Added Re-login button to re-authenticate via codex login", "Added Re-login button to re-authenticate via codex login",
@@ -494,7 +500,7 @@ class LauncherWin(Gtk.Window):
# header row # header row
hdr = Gtk.Box(spacing=8) hdr = Gtk.Box(spacing=8)
vbox.pack_start(hdr, False, False, 0) vbox.pack_start(hdr, False, False, 0)
lbl = Gtk.Label(label="<b>Codex Launcher v2.1.0</b>") lbl = Gtk.Label(label="<b>Codex Launcher v2.1.1</b>")
lbl.set_use_markup(True) lbl.set_use_markup(True)
hdr.pack_start(lbl, False, False, 0) hdr.pack_start(lbl, False, False, 0)
changelog_btn = Gtk.Button(label="Changelog") changelog_btn = Gtk.Button(label="Changelog")

View File

@@ -151,6 +151,8 @@ def oa_input_to_messages(input_data):
t = item.get("type") t = item.get("type")
if t == "message": if t == "message":
role = item.get("role", "user") role = item.get("role", "user")
if role == "developer":
role = "system"
text = "" text = ""
for part in item.get("content", []): for part in item.get("content", []):
pt = part.get("type", "") pt = part.get("type", "")
@@ -323,6 +325,8 @@ def an_input_to_messages(input_data):
t = item.get("type") t = item.get("type")
if t == "message": if t == "message":
role = item.get("role", "user") role = item.get("role", "user")
if role == "developer":
role = "user"
text = "" text = ""
for part in item.get("content", []): for part in item.get("content", []):
pt = part.get("type", "") pt = part.get("type", "")
@@ -532,7 +536,11 @@ class Handler(http.server.BaseHTTPRequestHandler):
def _handle_openai_compat(self, body, model, stream): def _handle_openai_compat(self, body, model, stream):
input_data = body.get("input", "") input_data = body.get("input", "")
chat_body = {"model": model, "messages": oa_input_to_messages(input_data)} messages = oa_input_to_messages(input_data)
instructions = body.get("instructions", "").strip()
if instructions:
messages.insert(0, {"role": "system", "content": instructions})
chat_body = {"model": model, "messages": messages}
for k in ("temperature", "top_p", "max_output_tokens"): for k in ("temperature", "top_p", "max_output_tokens"):
if k in body: if k in body:
chat_body["max_tokens" if k == "max_output_tokens" else k] = body[k] chat_body["max_tokens" if k == "max_output_tokens" else k] = body[k]
@@ -562,6 +570,9 @@ class Handler(http.server.BaseHTTPRequestHandler):
input_data = body.get("input", "") input_data = body.get("input", "")
an_body = {"model": model, "messages": an_input_to_messages(input_data), an_body = {"model": model, "messages": an_input_to_messages(input_data),
"max_tokens": body.get("max_output_tokens", 8192)} "max_tokens": body.get("max_output_tokens", 8192)}
instructions = body.get("instructions", "").strip()
if instructions:
an_body["system"] = instructions
for k in ("temperature", "top_p"): for k in ("temperature", "top_p"):
if k in body: if k in body:
an_body[k] = body[k] an_body[k] = body[k]