studio-entry.ts 918 B

123456789101112131415161718192021222324
  1. import { FFBLangChainService } from './services/ffb-langchain.service';
  2. import { FFBVectorService } from './services/ffb-vector.service';
  3. // 1. Mock the Gateway (it just needs to not crash when emitThought is called)
  4. const mockGateway = {
  5. emitThought: (socketId: string, payload: any) => {
  6. console.log(`[Studio Thought - ${socketId}]:`, payload.message);
  7. }
  8. } as any;
  9. // 2. Mock the Vector Service
  10. // Note: For real data in Studio, you'd connect to your dev Mongo here
  11. const mockVectorService = {
  12. vectorSearch: async () => [],
  13. aggregate: async () => [{ totalValue: 0 }],
  14. getDistinct: async () => [],
  15. getSchemaContext: async () => "Fields: site, weight, quantity, block, phase"
  16. } as any;
  17. // 3. Initialize the service
  18. const langChainService = new FFBLangChainService(mockVectorService, mockGateway);
  19. // 4. Export the compiled graph (Crucial for Studio)
  20. export const graph = langChainService['graph'];