@emblemvault/ask-ai (英语)
深链接提示AI服务. 为ChatGPT,克洛德,双子座,格罗克,Perplexity,Google AI,Kagi等公司预建了按钮和公用事业.
安装
npm install @emblemvault/ask-ai
快速启动
反应组件
import { AskAiGroup } from '@emblemvault/ask-ai';
function App() {
return (
<AskAiGroup
goal="Explain this code"
content={yourCodeContent}
services={{
chatgpt: true,
claude: true,
gemini: true,
}}
/>
);
}
服务器系统 URL 生成
import { buildServiceUrl, buildPrompt } from '@emblemvault/ask-ai/core';
const prompt = buildPrompt('Explain this code', codeContent, 'claude');
const url = buildServiceUrl('claude', prompt);
// Returns: https://claude.ai/new?q=...
CDN 使用量
<!-- Full bundle with React components -->
<script src="https://unpkg.com/@emblemvault/ask-ai/dist/browser/ask-ai.min.global.js"></script>
<!-- Core utilities only (no React) -->
<script src="https://unpkg.com/@emblemvault/ask-ai/dist/browser/ask-ai-core.min.global.js"></script>
<script>
const { buildServiceUrl, buildPrompt } = AskAi;
const url = buildServiceUrl('chatgpt', 'Hello world');
</script>
支助服务
| 服务 | 身份证 | 網址 |
|---|---|---|
| 聊天游戏 | chatgpt | (原始内容存档于2017-10-21). check.openai.com |
| 克劳德 | claude | 克劳德. 艾 |
| 双子座 | gemini | gemini.google.com (中文(简体) ) |
| 格鲁克 | grok | grok.x.ai (英语) |
| 复杂 | perplexity | 复杂度.ai |
| Google AI (英语) | google | aistudio.google.com (中文(中国大陆) ) |
| 嘉gi | kagi | kaki.com (英语) |
| 霍斯特探员 | agentHustle | (原始内容存档于2018-09-21). agenthustle.ai |
| 标志 Ai | emblemAi | 符号.bz |
构成部分
询问Ai 组
容器组件,使AI服务按钮具有可配置的快取.
<AskAiGroup
goal="Your prompt text"
content="Additional context (optional)"
services={{
chatgpt: true,
claude: { artifact: true },
gemini: { mode: 'pro' },
}}
size="default" // 'sm' | 'default' | 'lg'
variant="outline" // 'default' | 'outline' | 'ghost'
autoSubmit={true} // Auto-submit prompt on load
askUser="append" // 'append' | 'replace' - Show modal for user input
userPrompt="Custom modal label"
includeOriginUrl={false}
includeUrls={['/api/data', 'https://example.com/context']}
/>
爱按钮
特定AI服务的单个按钮.
<AiButton
service="claude"
prompt="Your prompt text"
options={{ artifact: true }}
size="default"
variant="outline"
autoSubmit={true}
/>
服务选项
克劳德
services={{
claude: {
artifact: true // Request artifact output
}
}}
聊天游戏
services={{
chatgpt: {
model: 'gpt-4o', // 'gpt-4', 'gpt-4o', 'gpt-4o-mini', 'o1', 'o3-mini'
temporary: true // Temporary chat
}
}}
双子座
services={{
gemini: {
mode: 'pro' // 'pro' | 'flash'
}
}}
复杂
services={{
perplexity: {
focus: 'web' // Search focus mode
}
}}
特工 Hustle / 标志 Ai
services={{
agentHustle: {
agent: 'agent-id' // Specific agent ID
},
emblemAi: {
agent: 'agent-id'
}
}}
核心公用事业
对于服务器侧用法或自定义执行:
import {
buildPrompt,
buildServiceUrl,
getServiceName,
isExternalService,
ServiceConfigs,
} from '@emblemvault/ask-ai/core';
// Build a prompt with service-specific formatting
const prompt = buildPrompt(
'Explain this', // goal
'code content here', // content
'claude', // service
{ artifact: true }, // options
'https://origin.com', // originUrl (optional)
['https://ref.com/data'] // additional URLs (optional)
);
// Generate service URL
const url = buildServiceUrl('claude', prompt, { artifact: true }, true);
// Get display name
getServiceName('chatgpt'); // 'ChatGPT'
// Check if opens in new tab
isExternalService('claude'); // true
询问用户模式
这个 askUser prop 允许用户输入的交互式模式 :
append: 以输入字段显示目标文本以附加附加文本replace: 显示一个空输入字段来替换整个提示
<AskAiGroup
goal="Create an image of"
askUser="append"
userPrompt="Describe what you want:"
services={{ chatgpt: true }}
/>
类型脚本
导出类型的全类型脚本支持 :
import type {
AiService,
AskAiGroupProps,
AiButtonProps,
ClaudeOptions,
ChatGptOptions,
GeminiOptions,
} from '@emblemvault/ask-ai';
许可证
麻省理工学院