mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 13:34:40 +00:00
var fx
This commit is contained in:
+7
-7
@@ -11,7 +11,7 @@ from discord.ext import commands
|
||||
|
||||
from constants import (
|
||||
LATEX_TEX_ENGINE, LATEX_MAX_COMPILE_SECONDS, LATEX_MAX_ATTACH_MB, LATEX_MAX_ZIP_MB,
|
||||
OPENAI_API_KEY, OPENAI_MODEL, LATEX_ALLOWED_ROLES, LATEX_GUILD_ID
|
||||
OPENAI_API_KEY, OPENAI_MODEL, ALLOWED_ROLES, GUILD_ID
|
||||
)
|
||||
from latex_functions import (
|
||||
is_tex_attachment, compile_single_tex_bytes, compile_zip_to_zip, ask_openai_diagnosis
|
||||
@@ -28,9 +28,9 @@ class LatexModule(commands.Cog):
|
||||
nsfw=False,
|
||||
name="tex",
|
||||
description="Kompiluje załączone .tex; PDF-y odsyła. Błędy: diagnoza z OpenAI.",
|
||||
guild=None if LATEX_GUILD_ID is None else discord.Object(id=LATEX_GUILD_ID),
|
||||
guild=None if GUILD_ID is None else discord.Object(id=GUILD_ID),
|
||||
)
|
||||
@commands.has_any_role(*LATEX_ALLOWED_ROLES)
|
||||
@commands.has_any_role(*ALLOWED_ROLES)
|
||||
async def tex(self, ctx: commands.Context, include_source_excerpt: Optional[bool] = True):
|
||||
ch = ctx.message.channel
|
||||
async with ch.typing():
|
||||
@@ -58,7 +58,7 @@ class LatexModule(commands.Cog):
|
||||
excerpt = data.decode("utf-8", errors="ignore")[:4000]
|
||||
except Exception:
|
||||
excerpt = ""
|
||||
advice = await ask_openai_diagnosis(res["log_text"] or "", excerpt, OPENAI_API_KEY, OPENAI_MODEL, logger=self.logger)
|
||||
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)
|
||||
@@ -72,9 +72,9 @@ class LatexModule(commands.Cog):
|
||||
nsfw=False,
|
||||
name="latexclean",
|
||||
description="Kompiluje .tex i odsyła TYLKO PDF (log w debug).",
|
||||
guild=None if LATEX_GUILD_ID is None else discord.Object(id=LATEX_GUILD_ID),
|
||||
guild=None if GUILD_ID is None else discord.Object(id=GUILD_ID),
|
||||
)
|
||||
@commands.has_any_role(*LATEX_ALLOWED_ROLES)
|
||||
@commands.has_any_role(*ALLOWED_ROLES)
|
||||
async def latexclean(self, ctx: commands.Context):
|
||||
ch = ctx.message.channel
|
||||
async with ch.typing():
|
||||
@@ -109,7 +109,7 @@ class LatexModule(commands.Cog):
|
||||
description="Wyślij ZIP z .tex → odeślę ZIP z PDF-ami (tylko udane)."
|
||||
)
|
||||
@app_commands.describe(archive=f"Archiwum .zip (max ~{LATEX_MAX_ZIP_MB} MiB)")
|
||||
@app_commands.checks.has_any_role(*LATEX_ALLOWED_ROLES)
|
||||
@app_commands.checks.has_any_role(*ALLOWED_ROLES)
|
||||
async def texbatch(self, interaction: discord.Interaction, archive: discord.Attachment):
|
||||
await interaction.response.defer()
|
||||
if not archive or not archive.filename.lower().endswith(".zip"):
|
||||
|
||||
Reference in New Issue
Block a user