chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -51,9 +51,7 @@ export async function minimaxUnderstandImage(params: {
|
||||
const imageDataUrl = params.imageDataUrl.trim();
|
||||
if (!imageDataUrl) throw new Error("MiniMax VLM: imageDataUrl required");
|
||||
if (!/^data:image\/(png|jpeg|webp);base64,/i.test(imageDataUrl)) {
|
||||
throw new Error(
|
||||
"MiniMax VLM: imageDataUrl must be a base64 data:image/(png|jpeg|webp) URL",
|
||||
);
|
||||
throw new Error("MiniMax VLM: imageDataUrl must be a base64 data:image/(png|jpeg|webp) URL");
|
||||
}
|
||||
|
||||
const host = coerceApiHost({
|
||||
@@ -92,17 +90,12 @@ export async function minimaxUnderstandImage(params: {
|
||||
throw new Error(`MiniMax VLM response was not JSON.${trace}`);
|
||||
}
|
||||
|
||||
const baseResp = isRecord(json.base_resp)
|
||||
? (json.base_resp as MinimaxBaseResp)
|
||||
: {};
|
||||
const code =
|
||||
typeof baseResp.status_code === "number" ? baseResp.status_code : -1;
|
||||
const baseResp = isRecord(json.base_resp) ? (json.base_resp as MinimaxBaseResp) : {};
|
||||
const code = typeof baseResp.status_code === "number" ? baseResp.status_code : -1;
|
||||
if (code !== 0) {
|
||||
const msg = (baseResp.status_msg ?? "").trim();
|
||||
const trace = traceId ? ` Trace-Id: ${traceId}` : "";
|
||||
throw new Error(
|
||||
`MiniMax VLM API error (${code})${msg ? `: ${msg}` : ""}.${trace}`,
|
||||
);
|
||||
throw new Error(`MiniMax VLM API error (${code})${msg ? `: ${msg}` : ""}.${trace}`);
|
||||
}
|
||||
|
||||
const content = pickString(json, "content").trim();
|
||||
|
||||
Reference in New Issue
Block a user