UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.45 kB
import{r as truncateUtf16Safe}from"./utf16-slice-DA3Mllbx.mjs";import"./text-utility-runtime-CDtGqkrl.mjs";import{n as OPENAI_CODEX_RESPONSES_BASE_URL}from"./base-url-Bj7R0VNs.mjs"; //!extensions/openai/image-generation-diagnostics.ts const LOG_VALUE_MAX_CHARS=256;function sanitizeLogValue(e){const t=(typeof e===`string`?e:typeof e===`number`||typeof e===`boolean`?String(e):``).replace(/[\r\n\u2028\u2029]+/g,` `).replace(/[\u200e\u200f\u202a-\u202e\u2066-\u2069]/gi,``).replace(/\p{Cc}+/gu,` `).replace(/\s+/g,` `).trim();if(!t)return`unknown`;return t.length>LOG_VALUE_MAX_CHARS?`${truncateUtf16Safe(t,LOG_VALUE_MAX_CHARS)}...`:t}function annotateDirectImageAuthFailure(e,t){if(!(e instanceof Error)||!(`status`in e)||e.status!==401&&e.status!==403)return;const n=URL.parse(t.url);const r=n?`${n.origin}${n.pathname}`:void 0;const i=t.authOverridden?`credential=configured-header source=models.providers.openai`:`credential=${sanitizeLogValue(t.authMode??`api-key`)} source=${sanitizeLogValue(t.authSource)}`;const a=t.explicitDirectRoute?`; explicit models.providers.openai settings select the direct Images API. To use a ChatGPT/Codex OAuth profile instead, set baseUrl "${OPENAI_CODEX_RESPONSES_BASE_URL}" and api "openai-chatgpt-responses", without apiKey, auth "api-key", or auth headers`:``;e.message=`${e.message} (route=images-api url=${sanitizeLogValue(r)} ${i}${a})`}export{sanitizeLogValue as n,annotateDirectImageAuthFailure as t};