tweak: add default driver mapping

This commit is contained in:
KernelDeimos 2024-08-03 21:00:13 -04:00
parent 3857870e61
commit e9d33ac7b3

View File

@ -129,7 +129,17 @@ class DriverService extends BaseService {
const svc_registry = this.services.get('registry');
const c_interfaces = svc_registry.get('interfaces');
driver = driver ?? iface;
// 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_to_driver[iface] ?? iface;
const driver_service_exists = (() => {
return this.services.has(driver) &&