tweak: add default driver mapping

This commit is contained in:
KernelDeimos 2024-08-03 21:00:13 -04:00 committed by Eric Dubé
parent 9a9bd5eaf0
commit 7aece26f4b

View File

@ -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) &&