mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
Added notion tool/block
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import { NotionIcon } from '@/components/icons'
|
||||
import { NotionResponse } from '@/tools/notion/read'
|
||||
import { BlockConfig } from '../types'
|
||||
|
||||
export const NotionBlock: BlockConfig<NotionResponse> = {
|
||||
type: 'notion_reader',
|
||||
toolbar: {
|
||||
title: 'Notion',
|
||||
description: 'Read and write to Notion pages and databases',
|
||||
bgColor: '#000000',
|
||||
icon: NotionIcon,
|
||||
category: 'tools',
|
||||
},
|
||||
tools: {
|
||||
access: ['notion_read', 'notion_write'],
|
||||
config: {
|
||||
tool: (params) => {
|
||||
return params.operation === 'write' ? 'notion_write' : 'notion_read'
|
||||
},
|
||||
},
|
||||
},
|
||||
workflow: {
|
||||
inputs: {
|
||||
pageId: { type: 'string', required: true },
|
||||
operation: { type: 'string', required: true },
|
||||
content: { type: 'string', required: false },
|
||||
apiKey: { type: 'string', required: true },
|
||||
},
|
||||
outputs: {
|
||||
response: {
|
||||
type: {
|
||||
content: 'string',
|
||||
metadata: 'any',
|
||||
},
|
||||
},
|
||||
},
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'operation',
|
||||
title: 'Operation',
|
||||
type: 'dropdown',
|
||||
layout: 'full',
|
||||
options: ['read', 'write'],
|
||||
},
|
||||
{
|
||||
id: 'pageId',
|
||||
title: 'Page ID',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter Notion page ID',
|
||||
},
|
||||
{
|
||||
id: 'content',
|
||||
title: 'Content',
|
||||
type: 'long-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter content to write (for write operation)',
|
||||
},
|
||||
{
|
||||
id: 'apiKey',
|
||||
title: 'API Key',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter your Notion API key',
|
||||
password: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { FirecrawlScrapeBlock } from './blocks/firecrawl'
|
||||
import { FunctionBlock } from './blocks/function'
|
||||
import { GitHubBlock } from './blocks/github'
|
||||
import { JinaBlock } from './blocks/jina'
|
||||
import { NotionBlock } from './blocks/notion'
|
||||
import { RouterBlock } from './blocks/router'
|
||||
import { SerperBlock } from './blocks/serper'
|
||||
import { SlackMessageBlock } from './blocks/slack'
|
||||
@@ -32,6 +33,7 @@ export {
|
||||
TavilyExtractBlock,
|
||||
RouterBlock,
|
||||
YouTubeSearchBlock,
|
||||
NotionBlock,
|
||||
}
|
||||
|
||||
// Registry of all block configurations
|
||||
@@ -51,6 +53,7 @@ const blocks: Record<string, BlockConfig> = {
|
||||
tavily_search: TavilySearchBlock,
|
||||
tavily_extract: TavilyExtractBlock,
|
||||
youtube_search: YouTubeSearchBlock,
|
||||
notion_reader: NotionBlock,
|
||||
}
|
||||
|
||||
// Build a reverse mapping of tools to block types
|
||||
|
||||
Reference in New Issue
Block a user