Files
sim/apps/sim/blocks/blocks/arxiv.ts
Emir Karabeg eed2072723 feat/platform-v3 (#1698)
* feat(fonts): season replacing geist

* feat(emcnn): created emcn

* feat(sidebar): created new sidebar with header and workflow list

* improvement(sidebar): expanded workflow/folder item text sizing and adjusted button padding

* feat(sidebar): added search UI, updated workflows styling

* improvement: globals styling with antialiased in dark mode only

* feat(sidebar): blocks and triggers ui/ux updated

* refactor(sidebar): moved logic into hooks

* feat(sidebar): improved workflow/folder dragging UI/UX; refactored logic into hooks

* improvement(sidebar): adjusted triggers/blocks padding for header

* improvement(sidebar): dragging hover handler; closed folders by default minus active path

* improvement(sidebar): panel resize logic

* improvement(sidebar): blocks and triggers expanded indicator

* feat(tooltips): new emcn component emerged

* feat(sidebar): workflow list handling updated

* refactor: added cursorrules

* feat(panel): new panel layout

* improvement(workspaces): firname's workspace instead of fn ln's workspace

* feat(platform): panel header, new emcn icons, more button variants, refactor sidebar components

* improvement(emcn): added button variants

* feat(panel): tab system

* feat(copilot): refactor, adjusted welcome and user-input UI/UX

* feat(copilot): baseline user-input ui/ux improvement

* feat(emcn): badge outline variant

* fix: build errors

* feat(copilot): base UI copilot

* refactor(workflow-block): added hooks, components

* feat(design): created design panel and removed isWide

* refactor(subblock): edited components, styling

* feat: emcn, editor

* feat(panel): toolbar, editor

* feat(workflow-block): refactor, adjust base styling

* feat(workflow-block): new block, edge

* feat: workflow-block, connections, action-bar, copilot

* feat: panel, workflow, emcn, workflow block, subblocks; clean copilot

* sim-326: remove remote code execution toggle, hide dropdown for language if E2B is not enabled

* feat: sidebar navigation, tag coloring; refactor: rebased to staging

* fix: build errors

* improvement: subblock styles

* feat: workspaces, terminal, emcn, controls

* feat: delete workflow

* fix: rebased

* fix build errors

---------

Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
2025-11-08 10:58:31 -08:00

154 lines
5.0 KiB
TypeScript

import { ArxivIcon } from '@/components/icons'
import type { BlockConfig } from '@/blocks/types'
import type { ArxivResponse } from '@/tools/arxiv/types'
export const ArxivBlock: BlockConfig<ArxivResponse> = {
type: 'arxiv',
name: 'ArXiv',
description: 'Search and retrieve academic papers from ArXiv',
longDescription:
'Integrates ArXiv into the workflow. Can search for papers, get paper details, and get author papers. Does not require OAuth or an API key.',
docsLink: 'https://docs.sim.ai/tools/arxiv',
category: 'tools',
bgColor: '#E0E0E0',
icon: ArxivIcon,
subBlocks: [
{
id: 'operation',
title: 'Operation',
type: 'dropdown',
options: [
{ label: 'Search Papers', id: 'arxiv_search' },
{ label: 'Get Paper Details', id: 'arxiv_get_paper' },
{ label: 'Get Author Papers', id: 'arxiv_get_author_papers' },
],
value: () => 'arxiv_search',
},
// Search operation inputs
{
id: 'searchQuery',
title: 'Search Query',
type: 'long-input',
placeholder: 'Enter search terms (e.g., "machine learning", "quantum physics")...',
condition: { field: 'operation', value: 'arxiv_search' },
required: true,
},
{
id: 'searchField',
title: 'Search Field',
type: 'dropdown',
options: [
{ label: 'All Fields', id: 'all' },
{ label: 'Title', id: 'ti' },
{ label: 'Author', id: 'au' },
{ label: 'Abstract', id: 'abs' },
{ label: 'Comment', id: 'co' },
{ label: 'Journal Reference', id: 'jr' },
{ label: 'Category', id: 'cat' },
{ label: 'Report Number', id: 'rn' },
],
value: () => 'all',
condition: { field: 'operation', value: 'arxiv_search' },
},
{
id: 'maxResults',
title: 'Max Results',
type: 'short-input',
placeholder: '10',
condition: { field: 'operation', value: 'arxiv_search' },
},
{
id: 'sortBy',
title: 'Sort By',
type: 'dropdown',
options: [
{ label: 'Relevance', id: 'relevance' },
{ label: 'Last Updated Date', id: 'lastUpdatedDate' },
{ label: 'Submitted Date', id: 'submittedDate' },
],
value: () => 'relevance',
condition: { field: 'operation', value: 'arxiv_search' },
},
{
id: 'sortOrder',
title: 'Sort Order',
type: 'dropdown',
options: [
{ label: 'Descending', id: 'descending' },
{ label: 'Ascending', id: 'ascending' },
],
value: () => 'descending',
condition: { field: 'operation', value: 'arxiv_search' },
},
// Get Paper Details operation inputs
{
id: 'paperId',
title: 'Paper ID',
type: 'short-input',
placeholder: 'Enter ArXiv paper ID (e.g., 1706.03762, cs.AI/0001001)',
condition: { field: 'operation', value: 'arxiv_get_paper' },
required: true,
},
// Get Author Papers operation inputs
{
id: 'authorName',
title: 'Author Name',
type: 'short-input',
placeholder: 'Enter author name (e.g., "John Smith")...',
condition: { field: 'operation', value: 'arxiv_get_author_papers' },
required: true,
},
{
id: 'maxResults',
title: 'Max Results',
type: 'short-input',
placeholder: '10',
condition: { field: 'operation', value: 'arxiv_get_author_papers' },
},
],
tools: {
access: ['arxiv_search', 'arxiv_get_paper', 'arxiv_get_author_papers'],
config: {
tool: (params) => {
// Convert maxResults to a number for operations that use it
if (params.maxResults) {
params.maxResults = Number(params.maxResults)
}
switch (params.operation) {
case 'arxiv_search':
return 'arxiv_search'
case 'arxiv_get_paper':
return 'arxiv_get_paper'
case 'arxiv_get_author_papers':
return 'arxiv_get_author_papers'
default:
return 'arxiv_search'
}
},
},
},
inputs: {
operation: { type: 'string', description: 'Operation to perform' },
// Search operation
searchQuery: { type: 'string', description: 'Search terms' },
searchField: { type: 'string', description: 'Field to search in' },
maxResults: { type: 'number', description: 'Maximum results to return' },
sortBy: { type: 'string', description: 'Sort results by' },
sortOrder: { type: 'string', description: 'Sort order direction' },
// Get Paper Details operation
paperId: { type: 'string', description: 'ArXiv paper identifier' },
// Get Author Papers operation
authorName: { type: 'string', description: 'Author name' },
},
outputs: {
// Search output
papers: { type: 'json', description: 'Found papers data' },
totalResults: { type: 'number', description: 'Total results count' },
// Get Paper Details output
paper: { type: 'json', description: 'Paper details' },
// Get Author Papers output
authorPapers: { type: 'json', description: 'Author papers list' },
},
}