|
| 1 | +import { BoChaIcon } from '@/components/icons' |
| 2 | +import type { BlockConfig } from '@/blocks/types' |
| 3 | +import type { BoChaSearchResponse } from '@/tools/bocha/types' |
| 4 | + |
| 5 | +export const BoChaBlock: BlockConfig<BoChaSearchResponse> = { |
| 6 | + type: 'bocha', |
| 7 | + name: 'BoCha', |
| 8 | + description: 'Search with BoCha', |
| 9 | + longDescription: |
| 10 | + 'Search the web using BoCha Instant Answers API. Returns instant answers, abstracts, related topics, and more.', |
| 11 | + docsLink: 'https://docs.sim.ai/tools/bocha', |
| 12 | + category: 'tools', |
| 13 | + bgColor: '#FFFFFF', |
| 14 | + icon: BoChaIcon, |
| 15 | + subBlocks: [ |
| 16 | + { |
| 17 | + id: 'query', |
| 18 | + title: 'Search Query', |
| 19 | + type: 'long-input', |
| 20 | + placeholder: 'Enter your search query', |
| 21 | + required: true, |
| 22 | + }, |
| 23 | + { |
| 24 | + id: 'freshness', |
| 25 | + title: 'Freshness', |
| 26 | + type: 'long-input', |
| 27 | + placeholder: 'noLimit', |
| 28 | + description: 'Search for web pages within a specified time range(noLimit/oneDay/oneWeek/oneMonth/oneYear/YYYY-MM-DD/YYYY-MM-DD/YYYY-MM-DD..YYYY-MM-DD)', |
| 29 | + }, |
| 30 | + { |
| 31 | + id: 'summary', |
| 32 | + title: 'Show Summary', |
| 33 | + type: 'switch', |
| 34 | + defaultValue: false, |
| 35 | + }, |
| 36 | + { |
| 37 | + id: 'count', |
| 38 | + title: 'Result Count', |
| 39 | + type: 'short-input', |
| 40 | + min: 1, |
| 41 | + max: 50, |
| 42 | + placeholder: 'e.g. 5', |
| 43 | + }, |
| 44 | + { |
| 45 | + id: 'include', |
| 46 | + title: 'Include Domains', |
| 47 | + type: 'long-input', |
| 48 | + placeholder: 'example.com | arxiv.org', |
| 49 | + description: 'Limit search to specific domains (separate by | or ,)', |
| 50 | + }, |
| 51 | + { |
| 52 | + id: 'exclude', |
| 53 | + title: 'Exclude Domains', |
| 54 | + type: 'long-input', |
| 55 | + placeholder: 'spam.com | ads.example', |
| 56 | + description: 'Exclude specific domains from search results', |
| 57 | + }, |
| 58 | + { |
| 59 | + id: 'apiKey', |
| 60 | + title: 'API Key', |
| 61 | + type: 'short-input', |
| 62 | + placeholder: 'Enter your BoCha API key', |
| 63 | + password: true, |
| 64 | + required: true, |
| 65 | + }, |
| 66 | + ], |
| 67 | + tools: { |
| 68 | + access: ['bocha_search'], |
| 69 | + config: { |
| 70 | + tool: () => 'bocha_search', |
| 71 | + }, |
| 72 | + }, |
| 73 | + inputs: { |
| 74 | + query: { type: 'string', description: 'Search query terms' }, |
| 75 | + freshness: { type: 'string', description: 'Time range filter for search results' }, |
| 76 | + summary: { type: 'boolean', description: 'Whether to return a text summary' }, |
| 77 | + count: { type: 'number', description: 'Maximum number of search results to return' }, |
| 78 | + include: { type: 'string', description: 'Domains to include in search results' }, |
| 79 | + exclude: { type: 'string', description: 'Domains to exclude from search results' }, |
| 80 | + apiKey: { type: 'string', description: 'BoCha API key' }, |
| 81 | + }, |
| 82 | + outputs: { |
| 83 | + query: { type: 'string', description: 'Search query used' }, |
| 84 | + results: { type: 'json', description: 'Array of external link results' }, |
| 85 | + }, |
| 86 | +} |
0 commit comments