mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
debug
This commit is contained in:
+5
-4
@@ -43,10 +43,10 @@ class LatexModule(commands.Cog):
|
||||
for att in atts:
|
||||
try:
|
||||
data = await att.read()
|
||||
self.logger.debug("LaTeX read %s bytes from %s", len(data), att.filename)
|
||||
self.logger.info("LaTeX read %s bytes from %s", len(data), att.filename)
|
||||
res = await compile_single_tex_bytes(data, att.filename, LATEX_TEX_ENGINE, LATEX_MAX_COMPILE_SECONDS, logger=self.logger)
|
||||
self.logger.debug("LaTeX result for %s: %s", att.filename, res)
|
||||
self.logger.debug("LaTeX log (%s)\n%s", att.filename, (res["log_text"] or "")[-2000:])
|
||||
self.logger.info("LaTeX result for %s: %s", att.filename, res)
|
||||
self.logger.info("LaTeX log (%s)\n%s", att.filename, (res["log_text"] or "")[-2000:])
|
||||
if res["ok"] and res["pdf_bytes"]:
|
||||
b = io.BytesIO(res["pdf_bytes"])
|
||||
b.seek(0)
|
||||
@@ -54,6 +54,7 @@ class LatexModule(commands.Cog):
|
||||
files.append(discord.File(b, filename=res["pdf_name"]))
|
||||
parts.append(f"✅ `{att.filename}` → `{res['pdf_name']}`")
|
||||
else:
|
||||
self.logger.info("LaTeX compile failed for %s", att.filename)
|
||||
excerpt = ""
|
||||
if include_source_excerpt:
|
||||
try:
|
||||
@@ -63,7 +64,7 @@ class LatexModule(commands.Cog):
|
||||
advice = await ask_openai_diagnosis(res["log_text"] or "", excerpt, OPENAI_MODEL, logger=self.logger)
|
||||
parts.append(f"❌ `{att.filename}` — błąd kompilacji.\nDiagnoza:\n{advice}")
|
||||
except Exception as e:
|
||||
self.logger.debug("Exception %s: %s", att.filename, e)
|
||||
self.logger.info("Exception %s: %s", att.filename, e)
|
||||
parts.append(f"⚠️ `{att.filename}` — wyjątek (szczegóły w logu).")
|
||||
|
||||
content = f"**LaTeX** — {len(atts)} plik(ów). Model: `{OPENAI_MODEL}`\n\n" + "\n\n".join(parts)
|
||||
|
||||
Reference in New Issue
Block a user