change moderate and initiatives
This commit is contained in:
@@ -1,19 +1,8 @@
|
||||
import { GigaChat, detectImage } from 'gigachat';
|
||||
import { Agent } from 'node:https';
|
||||
import { llm_gen } from './llm'
|
||||
import { detectImage } from 'gigachat';
|
||||
|
||||
const httpsAgent = new Agent({
|
||||
rejectUnauthorized: false,
|
||||
timeout: 60000
|
||||
});
|
||||
|
||||
export const llm = new GigaChat({
|
||||
credentials: process.env.GIGA_AUTH,
|
||||
model: 'GigaChat-2',
|
||||
httpsAgent,
|
||||
});
|
||||
|
||||
export const generatePicture = async (prompt: string) => {
|
||||
const resp = await llm.chat({
|
||||
export const generatePicture = async (prompt: string, GIGA_AUTH) => {
|
||||
const resp = await llm_gen(GIGA_AUTH).chat({
|
||||
messages: [
|
||||
{
|
||||
"role": "system",
|
||||
@@ -36,7 +25,7 @@ export const generatePicture = async (prompt: string) => {
|
||||
throw new Error('Не удалось получить UUID изображения из ответа GigaChat');
|
||||
}
|
||||
|
||||
const image = await llm.getImage(detectedImage.uuid);
|
||||
const image = await llm_gen(GIGA_AUTH).getImage(detectedImage.uuid);
|
||||
|
||||
// Возвращаем содержимое изображения, убеждаясь что это Buffer
|
||||
if (Buffer.isBuffer(image.content)) {
|
||||
|
||||
Reference in New Issue
Block a user