From 7aece26f4b7dd3abe1721d6d75510c3b8cd47831 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sat, 3 Aug 2024 21:00:13 -0400 Subject: [PATCH] tweak: add default driver mapping --- src/backend/src/services/drivers/DriverService.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/backend/src/services/drivers/DriverService.js b/src/backend/src/services/drivers/DriverService.js index c9f42775..8eb90823 100644 --- a/src/backend/src/services/drivers/DriverService.js +++ b/src/backend/src/services/drivers/DriverService.js @@ -128,8 +128,18 @@ class DriverService extends BaseService { const svc_registry = this.services.get('registry'); const c_interfaces = svc_registry.get('interfaces'); + + // There used to be only an 'interface' parameter but no 'driver' + // parameter. To support outdated clients we use this hard-coded + // table to map interfaces to default drivers. + const iface_to_driver = { + ['puter-ocr']: 'aws-textract', + ['puter-tts']: 'aws-polly', + ['puter-chat-completion']: 'openai-completion', + ['puter-image-generation']: 'openai-image-generation', + } - driver = driver ?? iface; + driver = driver ?? iface_to_driver[iface] ?? iface; const driver_service_exists = (() => { return this.services.has(driver) &&