|
|
@@ -1,3 +1,4 @@
|
|
|
+import { SysConfigService } from './../sys-config/sys-config.service'
|
|
|
import { Inject, Injectable, Logger, NotFoundException, OnModuleInit, forwardRef } from '@nestjs/common'
|
|
|
import { InjectRepository } from '@nestjs/typeorm'
|
|
|
import { Repository } from 'typeorm'
|
|
|
@@ -43,13 +44,18 @@ export class GameService implements OnModuleInit {
|
|
|
private readonly charactorRepository: Repository<Charactor>,
|
|
|
@Inject(forwardRef(() => EventsGateway))
|
|
|
private readonly eventsGateway: EventsGateway,
|
|
|
- private readonly promptService: PromptService
|
|
|
+ private readonly promptService: PromptService,
|
|
|
+ private readonly sysConfigService: SysConfigService
|
|
|
) {}
|
|
|
|
|
|
onModuleInit() {
|
|
|
this.llm = new ChatOpenAI({
|
|
|
- openAIApiKey: process.env.OPENAI_API_KEY,
|
|
|
- modelName: 'gpt-3.5-turbo-0613',
|
|
|
+ // openAIApiKey: process.env.OPENAI_API_KEY,
|
|
|
+ // modelName: 'gpt-3.5-turbo-0613',
|
|
|
+ azureOpenAIApiKey: process.env.AZURE_OPENAI_KEY,
|
|
|
+ azureOpenAIApiVersion: process.env.AZURE_OPENAI_VERSION,
|
|
|
+ azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_INSTANCE,
|
|
|
+ azureOpenAIApiDeploymentName: process.env.AZURE_OPENAI_DEPLOYMENT,
|
|
|
callbackManager: CallbackManager.fromHandlers({
|
|
|
async handleLLMStart(llm: Serialized, prompts: string[]) {
|
|
|
Logger.log(`LLM: ${JSON.stringify(llm)}`, 'LLM Start')
|