antdv-next/x/x-chat-provider

Claude Code and agent skill by antdv-next/x

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Focus on implementing custom Chat Provider, helping to adapt any streaming interface to Antdv Next X standard format

Install

npx vskill@latest install antdv-next/x/x-chat-provider

SKILL.md

🎯 Skill Positioning

This skill focuses on solving one problem: How to quickly adapt your streaming interface to Antdv Next X's Chat Provider.

Not involved: useXChat usage tutorial (that's another skill).

Table of Contents

📦 Technology Stack Overview

🏗️ Antdv Next X Ecosystem Architecture
LayerPackage NameCore PurposeTypical Usage Scenarios
UI Layer@antdv-next/xVue 3 UI component libraryBuild chat interfaces, bubbles, input boxes
Logic Layer@antdv-next/x-sdkDevelopment toolkitData flow management, Provider, Hook
Render Layer@antdv-next/x-markdownMarkdown rendererContent display, code highlighting
⚠️ Important Reminder: These three packages have different functional positioning, please import required features from the correct package
```ts
// ✅ Correct import examples
import { Bubble } from "@antdv-next/x"; // UI component
import { AbstractChatProvider } from "@antdv-next/x-sdk"; // Provider base class
import { XRequest } from "@antdv-next/x-sdk"; // Request tool
```
🔑 Core Concept Analysis
mermaid
graph LR
A[Original API Interface] -->|Adapt| B[Chat Provider]
B -->|Provide Data| C[useXChat Hook]
C -->|Render| D[Antdv Next X UI]
E[XRequest] -->|Network Request| B
ConceptRole PositioningCore ResponsibilityUsage Scenario
Chat Provider🔄 Data AdapterConvert any interface format to Antdv Next X standard formatPrivate API adaptation, format conversion
useXChat🧩 Vue 3 ComposableManage conversation state, message flow, request controlBuild AI conversation interface
XRequest🌐 Request ToolHandle all network communication, authentication, error handlingUnified request management

🚀 Quick Start

📋 Environment Preparation
System Requirements
PackageVersion RequirementAuto InstallPurpose
@antdv-next/x-sdk≥0.0.1✅Core SDK, includes Provider and Hook
@antdv-next/xLatest version✅UI component library, build chat interface
🛠️ One-click Environment Check
bash
# Auto check and fix version
npm ls @antdv-next/x-sdk
# If version doesn't match, auto prompt:
npm install @antdv-next/x-sdk@latest
📊 Version Compatibility Matrix
SDK VersionSupported FeaturesCompatibility
≥0.0.1Full Provider functionality✅ Recommended
🎯 Provider Selection Decision Tree
mermaid
graph TD
A[Start] --> B{Use Standard API?}
B -->|Yes| C[Use Built-in Provider]
B -->|No| D{Private API?}
D -->|Yes| E[Custom Provider]
D -->|No| F{Special Format?}
F -->|Yes| E
F -->|No| C
C --> G[OpenAI/DeepSeek Provider]
E --> H[Four Steps to Create Custom Provider]
🏭 Built-in Provider Overview
Out-of-the-box Providers
Provider TypeApplicable ScenarioUsage Method
OpenAI ProviderStandard OpenAI APIDirect import use
DeepSeek ProviderStandard DeepSeek APIDirect import use
Quick Decision Guide
ScenarioRecommended SolutionExample
Call official OpenAIBuilt-in OpenAI Providernew OpenAIProvider()
Call official DeepSeekBuilt-in DeepSeek Providernew DeepSeekProvider()
Company internal APICustom ProviderSee four-step implementation
Third-party non-standard APICustom ProviderSee four-step implementation

📋 Four Steps to Implement Custom Provider

🎯 Implementation Path Overview

mermaid
journey
title Custom Provider Implementation Path
section Analysis Phase
Interface Analysis: 2: User
section Development Phase
Create Class: 5: User
Check Validation: 1: User
section Integration Phase
Configure Usage: 1: User

Step1: Analyze Interface Format ⏱️ 2 minutes

📋 Interface Information Collection Table
Information TypeExample ValueYour Interface
Interface URLhttps://your-api.com/chat_____________
Request MethodPOST_____________
Request FormatJSON_____________
Response FormatServer-Sent Events_____________
Authentication MethodBearer Token_____________
🔍 Interface Format Template
✅ Request Format Example
ts
// Your actual request format
interface MyAPIRequest {
query: string; // User question
context?: string; // Conversation history (optional)
model?: string; // Model selection (optional)
stream?: boolean; // Whether streaming (optional)
}
✅ Response Format Example
ts
// Streaming response format
// Actual response: data: {"content": "answer content"}
interface MyAPIResponse {
content: string; // Answer fragment
finish_reason?: string; // End marker
}
// End marker: data: [DONE]

Step2: Create Provider Class ⏱️ 5 minutes

🏗️ Code Template (Copy and Use)
ts
// MyChatProvider.ts
import { AbstractChatProvider } from "@antdv-next/x-sdk";
// ====== 1st modification: Define your interface types ======
interface MyInput {
query: string;
context?: string;
model?: string;
stream?: boolean;
}
interface MyOutput {
content: string;
finish_reason?: string;
}
interface MyMessage {
content: string;
role: "user" | "assistant";
timestamp: number;
}
// ====== 2nd modification: Modify class name ======
export class MyChatProvider extends AbstractChatProvider<
MyMessage,
MyInput,
MyOutput
> {
// Parameter conversion: convert useXChat parameters to your API parameters
transformParams(
requestParams: Partial<MyInput>,
options: XRequestOptions<MyInput, MyOutput, MyMessage>,
): MyInput {
if (typeof requestParams !== "object") {
throw new Error("requestParams must be an object");
}
return {
query: requestParams.query || "",
context: requestParams.context,
model: "gpt-3.5-turbo", // Adjust according to your API
stream: true,
...(options?.params || {}),
};
}
// Local message: user sent message format
transformLocalMessage(requestParams: Partial<MyInput>): MyMessage {
return {
content: requestParams.query || "",
role: "user",
timestamp: Date.now(),
};
}
// ====== 3rd modification: Response data conversion ======
transformMessage(info: {
originMessage: MyMessage;
chunk: MyOutput;
}): MyMessage {
const { originMessage, chunk } = info;
// Handle end marker
if (!chunk?.content || chunk.content === "[DONE]") {
return { ...originMessage, status: "success" as const };
}
// Accumulate response content
return {
...originMessage,
content: `${originMessage.content || ""}${chunk.content || ""}`,
role: "assistant" as const,
status: "loading" as const,
};
}
}
🚨 Development Notes
  • ✅ Only change 3 places: interface types, class name, response conversion logic
  • ✅ Prohibit implementing request method: Network requests handled by XRequest
  • ✅ Maintain type safety: Use TypeScript strict mode

Step3: Check Validation ⏱️ 1 minute

✅ Quick Checklist
Check ItemStatusDescription
Correct class name⏳MyChatProvider → Your class name
Type matching⏳Interface types match actual API
Complete methods⏳All 3 methods implemented
No request method⏳Confirm no request method implemented
Type check passed⏳tsc --noEmit no errors
🔍 Validation Code
bash
# Run type check
npx tsc --noEmit MyChatProvider.ts
# Expected result: no error output

Step4: Configure Usage ⏱️ 1 minute

🔧 Complete Integration Example
ts
// 1. Import dependencies
import { MyChatProvider } from "./MyChatProvider";
import { XRequest } from "@antdv-next/x-sdk";
// 2. Configure XRequest (handled by x-request skill)
const request = XRequest("https://your-api.com/chat", {
// Authentication configuration
headers: {
Authorization: "Bearer your-token-here",
"Content-Type": "application/json",
},
// Default parameters
params: {
model: "gpt-3.5-turbo",
max_tokens: 1000,
temperature: 0.7,
},
// Streaming configuration
manual: true,
});
// 3. Create Provider instance
const provider = new MyChatProvider({
request, // Must pass XRequest instance
});
// 4. Now can be used with useXChat
// This part is handled by use-x-chat skill
export { provider };
🎉 Usage Advantages
  • Zero network code: XRequest handles all network details
  • Type safety: Complete TypeScript support
  • Easy testing: Can mock XRequest for unit testing
  • Unified configuration: Authentication, parameters, error handling centralized management

🔧 Common Scenario Adaptation

📚 Scenario Adaptation Guide

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
70
Repository forks
11
7-day trend score
21

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/antdv-next/x/x-chat-provider/badge)](https://verified-skill.com/skills/antdv-next/x/x-chat-provider)

Something wrong with this skill or its page? Tell us.