mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 14:03:42 +00:00
tweak: add default driver mapping
This commit is contained in:
parent
3857870e61
commit
e9d33ac7b3
@ -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) &&
|
||||
|
Loading…
Reference in New Issue
Block a user