Skip to content

Commit

Permalink
feat: add new enviroment variable DOCUMENT_NAME, move memory to servi…
Browse files Browse the repository at this point in the history
…ces folder
  • Loading branch information
JoseAlbDR committed Apr 13, 2024
1 parent 5f038aa commit f58b97e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 27 deletions.
2 changes: 2 additions & 0 deletions src/config/envs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ export const envs = {
JWT_SEED: get('JWT_SEED').required().asString(),

RABBITMQ_URL: get('RABBITMQ_URL').required().asString(),

DOCUMENT_NAME: get('DOCUMENT_NAME').required().asString(),
};
2 changes: 1 addition & 1 deletion src/presentation/chatbot/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Router } from 'express';
import { ChatbotService } from './service';
import { ChatbotController } from './controller';
import { envs } from '../../config/envs';
import { MemoryService } from '../memory/service';
import { MemoryService } from '../services/memory.service';
import { JWTAdapter } from '../../config/jwt.adapter';
import { AuthMiddleware } from '../middlewares/auth-middleware';

Expand Down
2 changes: 1 addition & 1 deletion src/presentation/chatbot/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@langchain/core/prompts';
import { BufferMemory } from 'langchain/memory';
import { createOpenAIFunctionsAgent, AgentExecutor } from 'langchain/agents';
import { MemoryService } from '../memory/service';
import { MemoryService } from '../services/memory.service';
import { ChatHistoryEntity } from '../../domain/entities/chat-history.entity';
import { BadRequestError, InternalServerError } from '../../domain/errors';
import { DynamicStructuredTool } from '@langchain/core/tools';
Expand Down
File renamed without changes.
26 changes: 1 addition & 25 deletions src/seed/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,12 @@ async function seed() {
const client = createClient(envs.SUPABASE_URL, envs.SUPABASE_PRIVATE_KEY);

//* Read File and Split
const filePath = path.resolve(__dirname, 'adoptaunpeludo.txt');
const filePath = path.resolve(__dirname, envs.DOCUMENT_NAME);
const text = await fs.readFile(filePath, 'utf-8');

const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 500,
chunkOverlap: 100,
// separators: [
// '<Inicio>',
// '<Usuario Anónimo>',
// '<Menu de Navegación>',
// '<Detalles de los Animales>',
// '<Detalles Ampliados de los Animales>',
// '<Asociaciones>',
// '<Autenticación y Cuentas>',
// '<Creación de Cuentas>',
// '<Verificación de Cuentas>',
// '<Recuperación de Contraseña>',
// '<Inicio de Sesión>',
// '<Usuario Autenticado>',
// '<Perfil de Usuario>',
// '<Detalles del Perfil>',
// '<Añadir a Favoritos>',
// '<Chat con Protectoras o Asociaciones>',
// '<Notificaciones>',
// '<Chats>',
// '<Gestión de Protectoras o Asociaciones>',
// '<Gestión de Anuncios de Adopción>',
// '<Eliminación de Cuenta>',
// '<Notificaciones por Correo Electrónico>',
// ],
});

const output = await splitter.createDocuments([text]);
Expand Down

0 comments on commit f58b97e

Please sign in to comment.