Socket
Book a DemoInstallSign in
Socket

@djangocfg/ext-knowbase

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@djangocfg/ext-knowbase

Knowledge base and chat extension for DjangoCFG

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

DjangoCFG Extension Preview

📦 View in Marketplace📖 Documentation⭐ GitHub

@djangocfg/ext-knowbase

Knowledge base and RAG-powered chat extension for DjangoCFG.

Part of DjangoCFG — modern Django framework for production-ready SaaS applications.

Features

  • 📚 Document Management - Upload, organize, and manage documentation
  • 💬 RAG-Powered Chat - AI chat with context from your documents
  • 📁 Archive Processing - Bulk upload and process ZIP archives
  • 🔍 Smart Search - Find information across all documents
  • 📊 Document Analytics - Track usage and engagement
  • 🔄 Auto-Processing - Automatic document parsing and indexing
  • 💾 Session Management - Persistent chat sessions

Install

pnpm add @djangocfg/ext-knowbase

Usage

Provider Setup

import { KnowbaseProvider } from '@djangocfg/ext-knowbase/hooks';

export default function RootLayout({ children }) {
  return (
    <KnowbaseProvider>
      {children}
    </KnowbaseProvider>
  );
}

Document Management

import {
  useKnowbaseDocumentsContext,
} from '@djangocfg/ext-knowbase/hooks';

function DocumentsPage() {
  const {
    documents,
    uploadDocument,
    deleteDocument,
    isLoadingDocuments,
  } = useKnowbaseDocumentsContext();

  const handleUpload = async (file: File) => {
    await uploadDocument({
      file,
      title: file.name,
      description: 'Uploaded document',
    });
  };

  return (
    <div>
      <input
        type="file"
        onChange={(e) => e.target.files && handleUpload(e.target.files[0])}
      />
      {documents.map(doc => (
        <div key={doc.id}>
          <h3>{doc.title}</h3>
          <p>Status: {doc.status}</p>
          <button onClick={() => deleteDocument(doc.id)}>Delete</button>
        </div>
      ))}
    </div>
  );
}

RAG-Powered Chat

import { useKnowbaseChatContext } from '@djangocfg/ext-knowbase/hooks';

function ChatInterface() {
  const { sendQuery, chatHistory, isLoading } = useKnowbaseChatContext();

  const handleSend = async (message: string) => {
    await sendQuery({
      query: message,
      session_id: sessionId,
    });
  };

  return (
    <div>
      {chatHistory.map((msg, idx) => (
        <div key={idx}>
          <strong>{msg.role}:</strong> {msg.content}
        </div>
      ))}
      <input
        onKeyDown={(e) => {
          if (e.key === 'Enter') {
            handleSend(e.currentTarget.value);
          }
        }}
        disabled={isLoading}
      />
    </div>
  );
}

Archive Processing

import { useKnowbaseDocumentsContext } from '@djangocfg/ext-knowbase/hooks';

function ArchiveUpload() {
  const { uploadArchive, getArchiveById } = useKnowbaseDocumentsContext();

  const handleArchiveUpload = async (file: File) => {
    const result = await uploadArchive({
      file,
      auto_process: true,
    });

    // Check processing status
    const archive = await getArchiveById(result.id);
    console.log('Processing status:', archive.processing_status);
  };

  return (
    <input
      type="file"
      accept=".zip"
      onChange={(e) => e.target.files && handleArchiveUpload(e.target.files[0])}
    />
  );
}

API Reference

Documents Context

  • documents - List of all documents
  • uploadDocument(data) - Upload single document
  • deleteDocument(id) - Delete document
  • updateDocument(id, data) - Update document metadata
  • getDocumentById(id) - Get document details
  • uploadArchive(data) - Upload ZIP archive
  • processArchive(id) - Trigger archive processing

Chat Context

  • sendQuery(data) - Send chat query to RAG system
  • chatHistory - Current chat session history
  • clearHistory() - Clear chat history
  • isLoading - Loading state

Sessions Context

  • sessions - List of chat sessions
  • createSession(data) - Create new session
  • deleteSession(id) - Delete session
  • getCurrentSession() - Get active session

License

MIT

Keywords

django

FAQs

Package last updated on 15 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts