fix(openai): convert realtime secret expiry · openclaw/openclaw@dca53af
steipete
·
2026-05-31
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { resolveExpiresAtMsFromEpochSeconds } from "openclaw/plugin-sdk/number-runtime"; |
1 | 2 | import { |
2 | 3 | createProviderHttpError, |
3 | 4 | resolveProviderRequestHeaders, |
@@ -125,9 +126,10 @@ async function createOpenAIRealtimeSecret(
|
125 | 126 | payload && typeof payload === "object" |
126 | 127 | ? (payload as Record<string, unknown>).expires_at |
127 | 128 | : undefined; |
| 129 | +const expiresAtMs = resolveExpiresAtMsFromEpochSeconds(expiresAt); |
128 | 130 | return { |
129 | 131 | value: clientSecret, |
130 | | - ...(typeof expiresAt === "number" ? { expiresAt } : {}), |
| 132 | + ...(expiresAtMs === undefined ? {} : { expiresAt: expiresAtMs }), |
131 | 133 | }; |
132 | 134 | } |
133 | 135 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -495,6 +495,7 @@ describe("buildOpenAIRealtimeVoiceProvider", () => {
|
495 | 495 | clientSecret: "client-secret-123", |
496 | 496 | offerUrl: "https://api.openai.com/v1/realtime/calls", |
497 | 497 | model: "gpt-realtime-2", |
| 498 | +expiresAt: 1_765_000_000_000, |
498 | 499 | }); |
499 | 500 | // originator, version, and User-Agent are server-side attribution headers; they |
500 | 501 | // must not be forwarded to the browser so that the browser's direct SDP POST to |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。