
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@codedevin/dify-cchat
Advanced tools
A beautiful and configurable chatbot widget for Dify integration with multiple display modes
A beautiful and configurable chatbot widget library for Dify integration with multiple display modes.
npm install dify-chat-tools
import React from "react";
import { DifyChatbot } from "dify-chat-tools";
const config = {
apiKey: "app-xxx", // Replace with your actual Dify app token
baseUrl: "https://api.dify.ai/v1",
userId: "user-id",
inputs: {},
};
function App() {
return (
<div style={{ height: "500px", width: "400px" }}>
<DifyChatbot
config={config}
title="AI Assistant"
placeholder="Type your message..."
/>
</div>
);
}
import React from "react";
import { DifyFloatingChatbot } from "dify-chat-tools";
function App() {
return (
<div>
{/* Your app content */}
<DifyFloatingChatbot
config={config}
position="bottom-right"
title="Help Assistant"
/>
</div>
);
}
import React from "react";
import { DifyTextSelectionChatbot } from "dify-chat-tools";
function App() {
return (
<div>
{/* Your content with selectable text */}
<p>Select any text to ask questions about it!</p>
<DifyTextSelectionChatbot
config={config}
enabled={true}
title="Text Assistant"
/>
</div>
);
}
interface DifyConfig {
apiKey: string; // Your Dify app token (format: app-xxx)
baseUrl: string; // Your Dify API base URL (default: https://api.dify.ai/v1)
userId?: string; // Optional user ID
inputs?: Record<string, any>; // Optional input variables
}
const config = {
apiKey: "app-xxx", // Replace with your actual Dify app token
baseUrl: "https://api.dify.ai/v1",
userId: "user-123",
inputs: {
language: "en",
context: "customer-support",
},
};
import { DifyChatbot, presetThemes } from "dify-chat-tools";
// Use light theme (default)
<DifyChatbot config={config} theme={presetThemes.light} />;
// Use dark theme
<DifyChatbot config={config} theme={presetThemes.dark} />;
Available preset themes:
light - Light theme with blue accents (default)dark - Dark themeconst customTheme = {
primary: "220 100% 50%",
secondary: "210 40% 96%",
background: "0 0% 100%",
text: "222.2 84% 4.9%",
border: "214.3 31.8% 91.4%",
borderRadius: "0.75rem",
fontFamily: "Inter, sans-serif",
};
<DifyChatbot config={config} theme={customTheme} />;
Main chatbot component for embedded use.
<DifyChatbot
config={config}
theme={theme}
title="AI Assistant"
subtitle="How can I help you?"
placeholder="Type your message..."
showHeader={true}
showAvatar={true}
allowFileUpload={true}
maxHeight={500}
maxWidth={400}
/>
Floating chatbot that appears as a button and expands into a chat window.
<DifyFloatingChatbot
config={config}
position="bottom-right"
offset={{ x: 20, y: 20 }}
defaultOpen={false}
onOpenChange={(open) => console.log("Chat is", open ? "open" : "closed")}
/>
Chatbot that appears when users select text on the page.
<DifyTextSelectionChatbot
config={config}
enabled={true}
minSelectionLength={5}
maxSelectionLength={1000}
targetAttribute="pfchat"
onSelectionChange={(text) => console.log("Selected:", text)}
/>
You can restrict text selection to specific elements by using the targetAttribute prop:
// Only text within elements with 'pfchat' attribute can trigger the chatbot
<DifyTextSelectionChatbot
config={config}
targetAttribute="pfchat"
/>
// In your HTML/JSX:
<div pfchat>
<p>This text can trigger the chatbot when selected.</p>
</div>
<div>
<p>This text will NOT trigger the chatbot when selected.</p>
</div>
| Prop | Type | Default | Description |
|---|---|---|---|
config | DifyConfig | Required | Dify configuration |
theme | ChatTheme | defaultTheme | Theme configuration |
title | string | "Chat Assistant" | Chatbot title |
subtitle | string | - | Chatbot subtitle |
placeholder | string | "Type your message..." | Input placeholder |
showHeader | boolean | true | Show header |
showAvatar | boolean | true | Show avatars |
allowFileUpload | boolean | true | Allow file uploads |
disabled | boolean | false | Disable chatbot |
| Prop | Type | Default | Description |
|---|---|---|---|
position | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'bottom-right' | Position on screen |
offset | { x: number; y: number } | { x: 0, y: 0 } | Offset from position |
defaultOpen | boolean | false | Initially open |
| Prop | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable text selection |
minSelectionLength | number | 3 | Minimum selection length |
maxSelectionLength | number | 1000 | Maximum selection length |
targetAttribute | string | - | Only trigger on elements with this attribute |
# Install dependencies
npm install
# Start development server
npm run dev
# Build library
npm run build:lib
# Type check
npm run type-check
MIT
FAQs
A beautiful and configurable chatbot widget for Dify integration with multiple display modes
The npm package @codedevin/dify-cchat receives a total of 6 weekly downloads. As such, @codedevin/dify-cchat popularity was classified as not popular.
We found that @codedevin/dify-cchat 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.