-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import { App } from '@slack/bolt'; | ||
import { SlackConfigService } from '../config/slackConfig.service'; | ||
import { SlackLoggerProxy } from '../logging/slack-logger-proxy.service'; | ||
import { SlackLoggerAdapter } from '../logging/slack-logger-proxy.service'; | ||
import { Provider } from '@nestjs/common'; | ||
|
||
export const slackServiceFactory: Provider = { | ||
provide: App, | ||
inject: [SlackConfigService, SlackLoggerProxy], | ||
useFactory: async (scs: SlackConfigService, logger: SlackLoggerProxy) => { | ||
inject: [SlackConfigService, SlackLoggerAdapter], | ||
useFactory: async (scs: SlackConfigService, logger: SlackLoggerAdapter) => { | ||
const opts = await scs.createSlackOptions(); | ||
return new App({ | ||
...opts, | ||
logger, | ||
// logLevel: LogLevel.DEBUG, | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import { slackServiceFactory } from './slackAppFactory'; | ||
import { Module, OnModuleInit } from '@nestjs/common'; | ||
import { Module, OnApplicationShutdown, OnModuleInit } from '@nestjs/common'; | ||
import { App } from '@slack/bolt'; | ||
import { SlackConfigService } from '../config/slackConfig.service'; | ||
import { GcpModule } from '../../../../shared/gcp/gcp.module'; | ||
import { SlackLoggerProxy } from '../logging/slack-logger-proxy.service'; | ||
import { SlackLoggerAdapter } from '../logging/slack-logger-proxy.service'; | ||
|
||
@Module({ | ||
imports: [GcpModule], | ||
providers: [slackServiceFactory, SlackConfigService, SlackLoggerProxy], | ||
providers: [slackServiceFactory, SlackConfigService, SlackLoggerAdapter], | ||
exports: [slackServiceFactory], | ||
}) | ||
export class SlackBoltModule implements OnModuleInit { | ||
export class SlackBoltModule implements OnModuleInit, OnApplicationShutdown { | ||
constructor(private readonly app: App) {} | ||
|
||
onModuleInit() { | ||
this.app.start(); | ||
} | ||
|
||
async onApplicationShutdown() { | ||
await this.app.stop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is fine for now, but once we build up the configuration interface we will need a way to recreate this when the user changes the settings for the model configuration.
WE could simplify things by just saying that you can't change model settings after a Chat is created, but I think it'll be a pretty standard thing to tweak the bot settings mid-conversation