Ajustes de rendering

This commit is contained in:
LeoMortari
2025-10-27 09:15:12 -03:00
parent ba768cf093
commit 8caa849148
5 changed files with 34 additions and 27 deletions

View File

@@ -137,7 +137,6 @@ class OpenRouterCopywriter:
body = {
"model": self.settings.openrouter.model,
"temperature": self.settings.openrouter.temperature,
"max_tokens": self.settings.openrouter.max_output_tokens,
"messages": [
{"role": "system", "content": prompt},
{
@@ -153,11 +152,18 @@ class OpenRouterCopywriter:
}
response = requests.post(
OPENROUTER_ENDPOINT, json=body, headers=headers, timeout=120
url=OPENROUTER_ENDPOINT,
data=json.dumps(body),
headers=headers,
timeout=120,
)
response.raise_for_status()
data = response.json()
choices = data.get("choices") or []
print("Data:")
print(data)
print("Choices:")
print(choices)
if not choices:
raise RuntimeError("OpenRouter nao retornou escolhas")