
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
React hooks for interacting with DocMind API.
npm install docmind-react
# or
yarn add docmind-react
# or
pnpm add docmind-react
import { useDocMind } from "docmind-react";
import { useState } from "react";
function ChatComponent() {
const [query, setQuery] = useState("");
const [response, setResponse] = useState("");
// Simple configuration with just the namespace
const { chat, loading, error } = useDocMind({
namespace: "your-namespace",
});
const handleSubmit = async (e) => {
e.preventDefault();
try {
await chat(query, {
onChunk: (chunk) => {
// Handle streaming chunks
setResponse((prev) => prev + chunk);
},
onComplete: (fullText) => {
// Final response
console.log("Chat completed:", fullText);
},
});
} catch (err) {
console.error("Chat error:", err);
}
};
return (
<div>
<form onSubmit={handleSubmit}>
<input
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Ask a question..."
/>
<button type="submit" disabled={loading}>
{loading ? "Sending..." : "Send"}
</button>
</form>
{error && <div className="error">{error.message}</div>}
<div className="response">
{response || "Ask a question to get started"}
</div>
</div>
);
}
import { useDocMind } from "docmind-react";
import { useState } from "react";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
function ChatDialog() {
const [query, setQuery] = useState("");
const [response, setResponse] = useState("");
const { chat, loading, error } = useDocMind({
namespace: "your-namespace",
});
const handleChat = async () => {
if (!query.trim()) return;
setResponse("");
await chat(query, {
onChunk: (chunk) => {
setResponse((prev) => prev + chunk);
},
});
};
return (
<Dialog>
<DialogTrigger asChild>
<Button>Ask DocMind</Button>
</DialogTrigger>
<DialogContent>
<Input
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Ask a question..."
/>
<Button onClick={handleChat} disabled={loading}>
{loading ? "Processing..." : "Send"}
</Button>
{response && <div>{response}</div>}
</DialogContent>
</Dialog>
);
}
You can also use the DocMind client directly if you need more control:
import { DocMind } from "docmind-react";
const client = new DocMind({
baseUrl: "http://localhost:3001",
namespace: "custom-namespace",
});
// Later in your code
async function sendMessage() {
const result = await client.chat("What is DocMind?", {
onChunk: (chunk) => console.log("Received chunk:", chunk),
onComplete: (text) => console.log("Complete response:", text),
onError: (error) => console.error("Error:", error),
});
console.log("Final text:", result.text);
}
useDocMind(config?: DocMindConfig)
React hook for integrating with DocMind API.
Parameters:
config
(optional): Configuration object with the following properties:
baseUrl
(optional): API base URL. Default: 'http://localhost:3001'
namespace
(optional): Namespace for document operations. Default: 'docmindsite1'
Returns:
chat
: Function to send chat messages and get responsesloading
: Boolean indicating if a request is in progresserror
: Error object if the last request failedDocMind
Client class for direct API interactions.
Methods:
constructor(config?: DocMindConfig)
: Create a new clientchat(query: string, options?: ChatStreamOptions)
: Send a chat messagesetNamespace(namespace: string)
: Set the namespaceMIT
FAQs
Unknown package
The npm package docmind-ai receives a total of 0 weekly downloads. As such, docmind-ai popularity was classified as not popular.
We found that docmind-ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.