@emblemvault/ask-ai

中文文档
0.1.1发布于 2025/12/25MITTypeScriptESM + CJS零依赖近 30 天下载 2258

Deep-link prompts to AI services (ChatGPT, Claude, Gemini, Grok, Perplexity, etc.)

原始使用文档
文档目录19 节
  1. Installation
  2. Quick Start
  3. React Components
  4. Server-Side URL Generation
  5. CDN Usage
  6. Supported Services
  7. Components
  8. AskAiGroup
  9. AiButton
  10. Service Options
  11. Claude
  12. ChatGPT
  13. Gemini
  14. Perplexity
  15. Agent Hustle / Emblem Ai
  16. Core Utilities
  17. askUser Modal
  18. TypeScript
  19. License

@emblemvault/ask-ai

Deep-link prompts to AI services. Pre-built buttons and utilities for ChatGPT, Claude, Gemini, Grok, Perplexity, Google AI, Kagi, and more.

Installation

npm install @emblemvault/ask-ai

Quick Start

React Components

import { AskAiGroup } from '@emblemvault/ask-ai';

function App() {
  return (
    <AskAiGroup
      goal="Explain this code"
      content={yourCodeContent}
      services={{
        chatgpt: true,
        claude: true,
        gemini: true,
      }}
    />
  );
}

Server-Side URL Generation

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 Usage

<!-- 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>

Supported Services

ServiceIDURL
ChatGPTchatgptchat.openai.com
Claudeclaudeclaude.ai
Geminigeminigemini.google.com
Grokgrokgrok.x.ai
Perplexityperplexityperplexity.ai
Google AIgoogleaistudio.google.com
Kagikagikagi.com
Agent HustleagentHustleagenthustle.ai
Emblem AiemblemAiemblem.bz

Components

AskAiGroup

Container component that renders AI service buttons with a configurable prompt.

<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']}
/>

AiButton

Individual button for a specific AI service.

<AiButton
  service="claude"
  prompt="Your prompt text"
  options={{ artifact: true }}
  size="default"
  variant="outline"
  autoSubmit={true}
/>

Service Options

Claude

services={{
  claude: {
    artifact: true  // Request artifact output
  }
}}

ChatGPT

services={{
  chatgpt: {
    model: 'gpt-4o',  // 'gpt-4', 'gpt-4o', 'gpt-4o-mini', 'o1', 'o3-mini'
    temporary: true   // Temporary chat
  }
}}

Gemini

services={{
  gemini: {
    mode: 'pro'  // 'pro' | 'flash'
  }
}}

Perplexity

services={{
  perplexity: {
    focus: 'web'  // Search focus mode
  }
}}

Agent Hustle / Emblem Ai

services={{
  agentHustle: {
    agent: 'agent-id'  // Specific agent ID
  },
  emblemAi: {
    agent: 'agent-id'
  }
}}

Core Utilities

For server-side usage or custom implementations:

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 Modal

The askUser prop enables an interactive modal for user input:

  • append: Displays the goal text with an input field to append additional text
  • replace: Shows an empty input field to replace the entire prompt
<AskAiGroup
  goal="Create an image of"
  askUser="append"
  userPrompt="Describe what you want:"
  services={{ chatgpt: true }}
/>

TypeScript

Full TypeScript support with exported types:

import type {
  AiService,
  AskAiGroupProps,
  AiButtonProps,
  ClaudeOptions,
  ChatGptOptions,
  GeminiOptions,
} from '@emblemvault/ask-ai';

License

MIT

版本与发布记录

@emblemvault/ask-ai 共发布 2 个版本,首次发布于 2025/12/25;过去 12 个月发布了 2 个版本。

版本发布日期距今
0.1.1latest2025/12/2510 个月前
0.1.02025/12/2510 个月前

关于 @emblemvault/ask-ai 的常见问题

@emblemvault/ask-ai 是什么?

Deep-link prompts to AI services (ChatGPT, Claude, Gemini, Grok, Perplexity, etc.)

如何安装 @emblemvault/ask-ai?

在项目目录运行 npm install @emblemvault/ask-ai,或使用 pnpm add / yarn add / bun add。

@emblemvault/ask-ai 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@emblemvault/ask-ai 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@emblemvault/ask-ai 可以商用吗?

@emblemvault/ask-ai 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@emblemvault/ask-ai 的下载量有多少?

根据 npm 官方下载统计,@emblemvault/ask-ai 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,258 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@emblemvault/ask-ai 还在维护吗?

最新版本 0.1.1 发布于 2025/12/25(10 个月前);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2025/12/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。