fix getting giga token
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
import { Agent } from 'node:https';
|
||||
import { GigaChat } from 'langchain-gigachat';
|
||||
import { getGigaAuth } from '../get-constants';
|
||||
|
||||
const httpsAgent = new Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
// Получаем GIGA_AUTH из переменной окружения (устанавливается в get-constants.js)
|
||||
export const gigachat = new GigaChat({
|
||||
model: 'GigaChat-2',
|
||||
temperature: 0.7,
|
||||
scope: 'GIGACHAT_API_PERS',
|
||||
streaming: false,
|
||||
credentials: process.env.GIGA_AUTH,
|
||||
httpsAgent
|
||||
});
|
||||
export const gigachat = (GIGA_AUTH) =>
|
||||
new GigaChat({
|
||||
model: 'GigaChat-2',
|
||||
temperature: 0.7,
|
||||
scope: 'GIGACHAT_API_PERS',
|
||||
streaming: false,
|
||||
credentials: GIGA_AUTH,
|
||||
httpsAgent
|
||||
});
|
||||
|
||||
export default gigachat;
|
||||
@@ -10,6 +10,7 @@ import { CreateTicketTool } from './create-ticket-tool';
|
||||
export interface SupportAgentConfig {
|
||||
temperature?: number;
|
||||
threadId?: string;
|
||||
GIGA_AUTH?: string;
|
||||
}
|
||||
|
||||
export interface SupportResponse {
|
||||
@@ -34,7 +35,7 @@ export class SupportAgent {
|
||||
this.memorySaver = new MemorySaver();
|
||||
this.isFirstMessage = true;
|
||||
|
||||
this.llm = gigachat;
|
||||
this.llm = gigachat(config.GIGA_AUTH);
|
||||
if (config.temperature !== undefined) {
|
||||
this.llm.temperature = config.temperature;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user