UI: move page to app/ui, model select next to 'Chiedi alle riunioni'; server/shots tweaks

This commit is contained in:
Stefano Zini
2026-11-04 13:14:46 +01:00
parent 6fe1c6c10d
commit 0c760ecabf
5 changed files with 199 additions and 166 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ EMAIL = re.compile(r"[\w.+-]+@[\w-]+\.[\w.-]+")
def _ask(path, json_mode=True):
img = base64.b64encode(path.read_bytes()).decode()
body = {"max_tokens": 1200, "temperature": 0.1,
body = {"max_tokens": 4000, "temperature": 0.1, # dense screens (mail/slides transcribed in "text") need ~2000 tok; 1200 truncated them -> empty cloud reply / bad JSON -> silent kind "other"
"chat_template_kwargs": {"enable_thinking": False},
"messages": [{"role": "user", "content": [{"type": "text", "text": PROMPT},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + img}}]}]}
@@ -56,7 +56,7 @@ def read_shot(path):
t = re.sub(r"<think>.*?</think>", "", t, flags=re.S)
d = json.loads(t[t.find("{"):t.rfind("}") + 1])
if isinstance(d, dict): return {**EMPTY, **d}
except (ValueError, KeyError): pass
except (ValueError, KeyError, IndexError): pass # IndexError: cloud returned empty "choices" (content filter / transient)
return dict(EMPTY)