Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow Logic Hooks

From Leeroopedia
Knowledge Sources
Domains Frontend, React_Hooks, Chat
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete collection of core React hooks for chat message handling, SSE streaming, document operations, and LLM interactions used across the RAGFlow frontend.

Description

The logic-hooks.ts module provides approximately 15 hooks covering: SSE-based message streaming (useFetchNextConversation), chat message management, document preview handling, LLM model option building, knowledge base operations, and conversation state management. These hooks form the primary business logic layer for the chat and conversation subsystem.

Usage

Import individual hooks when building chat views, conversation panels, or any component that needs to interact with the RAGFlow chat/conversation API via Server-Sent Events.

Code Reference

Source Location

Signature

// Key hooks (representative)
export function useFetchNextConversation(): { ... };
export function useSendMessageWithSse(conversationId: string): { ... };
export function useSelectLlmOptionsByModelType(): OptionType[];
export function useGetDocumentUrl(): (docId: string) => string;

Import

import { useFetchNextConversation, useSelectLlmOptionsByModelType } from '@/hooks/logic-hooks';

I/O Contract

Inputs

Name Type Required Description
conversationId string Varies Conversation ID for message hooks

Outputs

Name Type Description
Hook return values various State, callbacks, and derived data

Usage Examples

import { useSelectLlmOptionsByModelType } from '@/hooks/logic-hooks';

function ModelSelector() {
  const options = useSelectLlmOptionsByModelType();
  return <Select options={options} />;
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment