fix: fix some change

This commit is contained in:
2026-09-28 17:32:27 +03:30
parent 76f6c97a9e
commit 13ba11f951
@@ -3,8 +3,6 @@ import { ConfigService } from '@nestjs/config';
@Injectable()
export class ChatbotService {
private openRouter: any;
constructor(
/**
* Inject Config Service
@@ -13,23 +11,16 @@ export class ChatbotService {
) {}
private async getOpenRouter() {
if (!this.openRouter) {
const { OpenRouter } = await import('@openrouter/sdk');
this.openRouter = new OpenRouter({
return new OpenRouter({
apiKey: this.configService.get<string>('openRouter.apiKey'),
});
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return this.openRouter;
}
public async chat(message: string) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const openRouter = await this.getOpenRouter();
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
const response = await openRouter.chat.send({
chatRequest: {
model: this.configService.get<string>('openRouter.model'),
@@ -63,7 +54,6 @@ export class ChatbotService {
throw new Error('Expected non-streaming response');
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
const content = response.choices[0]?.message?.content;
if (typeof content !== 'string') {