Skip to content

Commit 81bf092

Browse files
committed
fix(latex): fail compile/package lookups that return no payload
1 parent e84a50a commit 81bf092

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

apps/sim/tools/latex/compile.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ export const latexCompileTool: ToolConfig<LatexCompileParams, LatexCompileRespon
100100
}
101101
: '')
102102

103+
if (!pdf) {
104+
return {
105+
success: false,
106+
error: 'LaTeX compile response did not include a PDF',
107+
output: {
108+
pdf: '',
109+
pdfUrl: '',
110+
fileName: '',
111+
compiler: data.compiler || '',
112+
},
113+
}
114+
}
115+
103116
return {
104117
success: true,
105118
output: {

apps/sim/tools/latex/get_package.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,33 @@ export const latexGetPackageTool: ToolConfig<LatexGetPackageParams, LatexGetPack
4141
}
4242
}
4343

44-
const pkg = data.package ?? {}
44+
const pkg = data.package
45+
if (!pkg?.package) {
46+
return {
47+
success: false,
48+
error: 'Package not found',
49+
output: {
50+
package: {
51+
name: '',
52+
installed: false,
53+
shortDescription: null,
54+
longDescription: null,
55+
category: null,
56+
license: null,
57+
topics: [],
58+
relatedPackages: [],
59+
homepage: null,
60+
ctanUrl: null,
61+
},
62+
},
63+
}
64+
}
4565

4666
return {
4767
success: true,
4868
output: {
4969
package: {
50-
name: pkg.package ?? '',
70+
name: pkg.package,
5171
installed: pkg.installed ?? false,
5272
shortDescription: pkg.shortdesc ?? null,
5373
longDescription: pkg.longdesc ?? null,

0 commit comments

Comments
 (0)