mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
fix: disable unconfigured ai services
This commit is contained in:
parent
c97688706e
commit
476acae0e0
@ -1,4 +1,5 @@
|
|||||||
const { AdvancedBase } = require("@heyputer/puter-js-common");
|
const { AdvancedBase } = require("@heyputer/puter-js-common");
|
||||||
|
const config = require("../../config");
|
||||||
|
|
||||||
class PuterAIModule extends AdvancedBase {
|
class PuterAIModule extends AdvancedBase {
|
||||||
async install (context) {
|
async install (context) {
|
||||||
@ -7,18 +8,27 @@ class PuterAIModule extends AdvancedBase {
|
|||||||
const { AIInterfaceService } = require('./AIInterfaceService');
|
const { AIInterfaceService } = require('./AIInterfaceService');
|
||||||
services.registerService('__ai-interfaces', AIInterfaceService);
|
services.registerService('__ai-interfaces', AIInterfaceService);
|
||||||
|
|
||||||
|
// TODO: services should govern their own availability instead of
|
||||||
|
// the module deciding what to register
|
||||||
|
|
||||||
|
if ( !! config?.services?.['aws-textract']?.aws ) {
|
||||||
const { AWSTextractService } = require('./AWSTextractService');
|
const { AWSTextractService } = require('./AWSTextractService');
|
||||||
services.registerService('aws-textract', AWSTextractService);
|
services.registerService('aws-textract', AWSTextractService);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !! config?.services?.['aws-polly']?.aws ) {
|
||||||
const { AWSPollyService } = require('./AWSPollyService');
|
const { AWSPollyService } = require('./AWSPollyService');
|
||||||
services.registerService('aws-polly', AWSPollyService);
|
services.registerService('aws-polly', AWSPollyService);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !! config?.openai ) {
|
||||||
const { OpenAICompletionService } = require('./OpenAICompletionService');
|
const { OpenAICompletionService } = require('./OpenAICompletionService');
|
||||||
services.registerService('openai-completion', OpenAICompletionService);
|
services.registerService('openai-completion', OpenAICompletionService);
|
||||||
|
|
||||||
const { OpenAIImageGenerationService } = require('./OpenAIImageGenerationService');
|
const { OpenAIImageGenerationService } = require('./OpenAIImageGenerationService');
|
||||||
services.registerService('openai-image-generation', OpenAIImageGenerationService);
|
services.registerService('openai-image-generation', OpenAIImageGenerationService);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
Reference in New Issue
Block a user