(value: unknown)
| 141 | } |
| 142 | |
| 143 | export function normalizeImageGenerationMethod(value: unknown): string { |
| 144 | const candidate = String(value ?? "") |
| 145 | .trim() |
| 146 | .toLowerCase(); |
| 147 | if (candidate === IMAGE_METHOD_IMAGINE_WS_EXPERIMENTAL) { |
| 148 | return IMAGE_METHOD_IMAGINE_WS_EXPERIMENTAL; |
| 149 | } |
| 150 | if (IMAGE_METHOD_ALIASES[candidate]) { |
| 151 | return IMAGE_METHOD_ALIASES[candidate]; |
| 152 | } |
| 153 | return IMAGE_METHOD_LEGACY; |
| 154 | } |
| 155 | |
| 156 | export async function getSettings(env: Env): Promise<SettingsBundle> { |
| 157 | const globalRow = await dbFirst<{ value: string }>( |
no outgoing calls
no test coverage detected