refactor: trim provider internal exports · openclaw/openclaw@19cb778
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,8 +51,8 @@ function isSupportedRegion(region: string): boolean {
|
51 | 51 | // Bearer token resolution |
52 | 52 | // --------------------------------------------------------------------------- |
53 | 53 | |
54 | | -export type MantleBearerTokenProvider = () => Promise<string>; |
55 | | -export type MantleBearerTokenProviderFactory = (opts?: { |
| 54 | +type MantleBearerTokenProvider = () => Promise<string>; |
| 55 | +type MantleBearerTokenProviderFactory = (opts?: { |
56 | 56 | region?: string; |
57 | 57 | expiresInSeconds?: number; |
58 | 58 | }) => MantleBearerTokenProvider; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtim
|
10 | 10 | // Types & constants |
11 | 11 | // --------------------------------------------------------------------------- |
12 | 12 | |
13 | | -export type BedrockEmbeddingClient = { |
| 13 | +type BedrockEmbeddingClient = { |
14 | 14 | region: string; |
15 | 15 | model: string; |
16 | 16 | dimensions?: number; |
@@ -162,7 +162,7 @@ async function loadCredentialProviderSdk(): Promise<AwsCredentialProviderSdk | n
|
162 | 162 | const MODEL_PREFIX_RE = /^(?:bedrock|amazon-bedrock|aws)\//; |
163 | 163 | const REGION_RE = /bedrock-runtime\.([a-z0-9-]+)\./; |
164 | 164 | |
165 | | -export function normalizeBedrockEmbeddingModel(model: string): string { |
| 165 | +function normalizeBedrockEmbeddingModel(model: string): string { |
166 | 166 | const trimmed = model.trim(); |
167 | 167 | return trimmed ? trimmed.replace(MODEL_PREFIX_RE, "") : DEFAULT_BEDROCK_EMBEDDING_MODEL; |
168 | 168 | } |
@@ -337,7 +337,7 @@ export async function createBedrockEmbeddingProvider(
|
337 | 337 | // Client resolution |
338 | 338 | // --------------------------------------------------------------------------- |
339 | 339 | |
340 | | -export function resolveBedrockEmbeddingClient( |
| 340 | +function resolveBedrockEmbeddingClient( |
341 | 341 | options: MemoryEmbeddingProviderCreateOptions, |
342 | 342 | ): BedrockEmbeddingClient { |
343 | 343 | const model = normalizeBedrockEmbeddingModel(options.model); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -165,7 +165,7 @@ function toCanonicalAnthropicModelRef(ref: string): string {
|
165 | 165 | : ref; |
166 | 166 | } |
167 | 167 | |
168 | | -export function normalizeAnthropicProviderConfig<T extends { api?: string; models?: unknown[] }>( |
| 168 | +function normalizeAnthropicProviderConfig<T extends { api?: string; models?: unknown[] }>( |
169 | 169 | providerConfig: T, |
170 | 170 | ): T { |
171 | 171 | if ( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ export const DEFAULT_AZURE_SPEECH_AUDIO_FORMAT = "audio-24khz-48kbitrate-mono-mp
|
12 | 12 | export const DEFAULT_AZURE_SPEECH_VOICE_NOTE_FORMAT = "ogg-24khz-16bit-mono-opus"; |
13 | 13 | export const DEFAULT_AZURE_SPEECH_TELEPHONY_FORMAT = "raw-8khz-8bit-mono-mulaw"; |
14 | 14 | |
15 | | -export type AzureSpeechVoiceEntry = { |
| 15 | +type AzureSpeechVoiceEntry = { |
16 | 16 | ShortName?: string; |
17 | 17 | DisplayName?: string; |
18 | 18 | LocalName?: string; |
@@ -52,11 +52,11 @@ function azureSpeechUrl(params: {
|
52 | 52 | return `${baseUrl}${params.path}`; |
53 | 53 | } |
54 | 54 | |
55 | | -export function escapeXmlText(text: string): string { |
| 55 | +function escapeXmlText(text: string): string { |
56 | 56 | return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); |
57 | 57 | } |
58 | 58 | |
59 | | -export function escapeXmlAttr(value: string): string { |
| 59 | +function escapeXmlAttr(value: string): string { |
60 | 60 | return escapeXmlText(value).replace(/"/g, """).replace(/'/g, "'"); |
61 | 61 | } |
62 | 62 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ import {
|
8 | 8 | resolveCloudflareAiGatewayBaseUrl, |
9 | 9 | } from "./models.js"; |
10 | 10 | |
11 | | -export type CloudflareAiGatewayCredential = |
| 11 | +type CloudflareAiGatewayCredential = |
12 | 12 | | { |
13 | 13 | type?: string; |
14 | 14 | keyRef?: unknown; |
@@ -20,9 +20,7 @@ export type CloudflareAiGatewayCredential =
|
20 | 20 | } |
21 | 21 | | undefined; |
22 | 22 | |
23 | | -export function resolveCloudflareAiGatewayApiKey( |
24 | | -cred: CloudflareAiGatewayCredential, |
25 | | -): string | undefined { |
| 23 | +function resolveCloudflareAiGatewayApiKey(cred: CloudflareAiGatewayCredential): string | undefined { |
26 | 24 | if (!cred || cred.type !== "api_key") { |
27 | 25 | return undefined; |
28 | 26 | } |
@@ -35,7 +33,7 @@ export function resolveCloudflareAiGatewayApiKey(
|
35 | 33 | return normalizeOptionalString(cred.key); |
36 | 34 | } |
37 | 35 | |
38 | | -export function resolveCloudflareAiGatewayMetadata(cred: CloudflareAiGatewayCredential): { |
| 36 | +function resolveCloudflareAiGatewayMetadata(cred: CloudflareAiGatewayCredential): { |
39 | 37 | accountId?: string; |
40 | 38 | gatewayId?: string; |
41 | 39 | } { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。