ported from the standalone officer-atelier service: providers (adapter-shaped, openai the only adapter today), the generation queue, collections, and the database layer — kept on its own Postgres database rather than folded into officer_db, since both collections and provider_settings had rows on the machine this was extracted from. what changed rather than just moved: - images are served from an authenticated GET /files/:filename instead of an unauthenticated PUBLIC_URL-prefixed static route - the OpenAI-key bootstrap fallback reads the secret store (getSecret) before .env, per-adapter - provider_settings (the one-row-per-adapter shape providers replaced) did not come along — it has no callers left anywhere in the server code, only a migration script that also did not move ping/echo (smoke-test routes with no caller) did not move either; the sidecar's own /_health covers liveness. not yet wired into the platform: sidecar/index.ts exists but nothing mounts it, and web/ has not been written, so this is not yet a discoverable plugin.
22 lines
880 B
TypeScript
22 lines
880 B
TypeScript
import { openaiAdapter } from './openai';
|
|
import type { ImageAdapter } from './types';
|
|
|
|
export * from './types';
|
|
|
|
/**
|
|
* Every adapter Atelier can speak — the CODE side.
|
|
*
|
|
* An adapter knows a vendor's HTTP API. It is written once and rarely changes. What model to use,
|
|
* whose key, and whether it is switched on are not its business: those are a `providers` row, made
|
|
* and edited at runtime. Several providers can share one adapter, which is the entire point — OpenAI
|
|
* with gpt-image-1 and OpenAI with dall-e-3 are two configurations of one piece of code.
|
|
*
|
|
* A list in one place, the way `hono.ts` keeps its mounts: adding an adapter is a new file plus a
|
|
* line here.
|
|
*/
|
|
export const ADAPTERS: ImageAdapter[] = [openaiAdapter];
|
|
|
|
export function adapterByName(name: string): ImageAdapter | undefined {
|
|
return ADAPTERS.find((adapter) => adapter.name === name);
|
|
}
|