ワンクリックで
use-x-chat
Focus on explaining how to use the useXChat Hook, including custom Provider integration, message management, error handling, etc.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Focus on explaining how to use the useXChat Hook, including custom Provider integration, message management, error handling, etc.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
跨仓库 PR 同步追踪技能。当用户需要追踪一个上游仓库(如 ant-design)的 fix/feature 变更,并同步到下游移植仓库(如 antdv-next)时使用此技能。 触发场景:用户给出一个起始 commit SHA,需要列出从该 commit 往后所有需要同步的 PR, 并生成带优先级排序的同步表格和 checklist 模板。 也适用于:两个仓库之间的变更追踪、上下游组件库同步分析、跨框架移植任务管理。 如果用户提到"同步上游"、"追踪 PR"、"从某个 commit 开始"、"移植 fix"、"同步 issue" 等关键词,务必使用此技能。 特别地:若用户只说"同步仓库"、"继续同步"、"sync",应优先读取下游仓库根目录的 .sync-upstream.json 文件,从中获取上次同步位置,无需用户再次提供任何参数。
Focus on implementing custom Chat Provider, helping to adapt any streaming interface to Antdv Next X standard format
Use when building or reviewing Markdown rendering with @antdv-next/x-markdown, including streaming Markdown, custom component mapping, plugins, themes, and chat-oriented rich content.
Focus on explaining the practical configuration and usage of XRequest, providing accurate configuration instructions based on official documentation
专注讲解如何使用 useXChat Hook,包括自定义 Provider 的集成、消息管理、错误处理等
专注于自定义 Chat Provider 的实现,帮助将任意流式接口适配为 Antdv Next X 标准格式
| name | use-x-chat |
| version | 0.0.1 |
| description | Focus on explaining how to use the useXChat Hook, including custom Provider integration, message management, error handling, etc. |
Core Positioning: Use the
useXChatHook to build professional AI conversation applications Prerequisites: Already have a custom Chat Provider (refer to x-chat-provider skill)
If version mismatch is detected, the skill will automatically:
The use-x-chat skill has built-in version checking functionality, automatically checking version compatibility on startup:
🔍 Auto-check Function The skill will automatically check if the @antdv-next/x-sdk version meets requirements on startup:
📋 Check Contents:
🛠️ Version Issue Fix If version mismatch is detected, the skill will provide specific fix commands:
# Auto-prompted fix commands
npm install @antdv-next/x-sdk@latest
This part is handled by the x-chat-provider skill
import { MyChatProvider } from "./MyChatProvider";
import { XRequest } from "@antdv-next/x-sdk";
// Recommended to use XRequest as the default request method
const provider = new MyChatProvider({
// Default use XRequest, no need for custom fetch
request: XRequest("https://your-api.com/chat"),
// When requestPlaceholder is set, placeholder message will be displayed before request starts
requestPlaceholder: {
content: "Thinking...",
role: "assistant",
timestamp: Date.now(),
},
// When requestFallback is set, fallback message will be displayed when request fails
requestFallback: (_, { error, errorInfo, messageInfo }) => {
if (error.name === "AbortError") {
return {
content: messageInfo?.message?.content || "Reply cancelled",
role: "assistant" as const,
timestamp: Date.now(),
};
}
return {
content:
errorInfo?.error?.message || "Network error, please try again later",
role: "assistant" as const,
timestamp: Date.now(),
};
},
});
import { defineComponent } from "vue";
import { useXChat } from "@antdv-next/x-sdk";
const ChatComponent = defineComponent(() => {
const { messages, onRequest, isRequesting } = useXChat({ provider });
return () => (
<div>
{messages.value.map(msg => (
<div key={msg.id}>
{msg.message.role}: {msg.message.content}
</div>
))}
<button onClick={() => onRequest({ query: "Hello" })}>Send</button>
</div>
);
});
import { defineComponent } from "vue";
import { Bubble, Sender } from "@antdv-next/x";
import { useXChat } from "@antdv-next/x-sdk";
const ChatUI = defineComponent(() => {
const { messages, onRequest, isRequesting, abort } = useXChat({ provider });
return () => (
<div style={{ height: "600px" }}>
<Bubble.List items={messages.value} />
<Sender
loading={isRequesting.value}
onSubmit={content => onRequest({ query: content })}
onCancel={abort}
/>
</div>
);
});
graph TD
A[useXChat Hook] --> B[Chat Provider]
B --> C[XRequest]
A --> D[Antdv Next X UI]
D --> E[Bubble Component]
D --> F[Sender Component]
⚠️ Important Reminder:
messagestype isRef<MessageInfo<MessageType>[]>, not directMessageType. Access viamessages.value.
interface MessageInfo<Message> {
id: number | string; // Message unique identifier
message: Message; // Actual message content
status: MessageStatus; // Sending status
extraInfo?: AnyObject; // Extended information
}
// Message status enum
type MessageStatus =
| "local"
| "loading"
| "updating"
| "success"
| "error"
| "abort";
💡 Tip: API may update with versions, it is recommended to check official documentation for the latest information
Core functionality reference content CORE.md
use-x-chat must depend on one of the following skills:
| Dependency Type | Skill | Description | Required |
|---|---|---|---|
| Core Dependency | x-chat-provider | Provides custom Provider instance, default uses XRequest, must be used with use-x-chat | Required |
| Or | Built-in Provider | OpenAI/DeepSeek and other built-in Providers, default uses XRequest | Required |
| Recommended Dependency | x-request | Configure request parameters and authentication, as the default request method | Recommended |
| Usage Scenario | Required Skill Combination | Usage Order |
|---|---|---|
| Private API Adaptation | x-chat-provider → use-x-chat | Create Provider first, then use |
| Standard API Usage | use-x-chat (built-in Provider) | Direct use |
| Authentication Configuration Needed | x-request → use-x-chat | Configure request first, then use |
| Complete Customization | x-chat-provider → x-request → use-x-chat | Complete workflow |
tsc --noEmit to ensure no type errors