Skip to content

Commit

Permalink
Changing 'Output Schema' to 'Input Schema' (#2199)
Browse files Browse the repository at this point in the history
  • Loading branch information
automaton82 authored Apr 17, 2024
1 parent 1ccd3c7 commit 2cadd68
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/server/marketplaces/tools/Make Webhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"color": "linear-gradient(rgb(19,94,2), rgb(19,124,59))",
"iconSrc": "https://github.com/FlowiseAI/Flowise/assets/26460777/517fdab2-8a6e-4781-b3c8-fb92cc78aa0b",
"schema": "[{\"id\":0,\"property\":\"message\",\"description\":\"Message to send\",\"type\":\"string\",\"required\":true}]",
"func": "/*\n* You can use any libraries imported in Flowise\n* You can use properties specified in Output Schema as variables. Ex: Property = userid, Variable = $userid\n* Must return a string value at the end of function\n*/\n\nconst fetch = require('node-fetch');\nconst webhookUrl = 'https://hook.eu1.make.com/abcdefg';\nconst body = {\n\t\"message\": $message\n};\nconst options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(body)\n};\ntry {\n const response = await fetch(webhookUrl, options);\n const text = await response.text();\n return text;\n} catch (error) {\n console.error(error);\n return '';\n}"
"func": "/*\n* You can use any libraries imported in Flowise\n* You can use properties specified in Input Schema as variables. Ex: Property = userid, Variable = $userid\n* Must return a string value at the end of function\n*/\n\nconst fetch = require('node-fetch');\nconst webhookUrl = 'https://hook.eu1.make.com/abcdefg';\nconst body = {\n\t\"message\": $message\n};\nconst options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(body)\n};\ntry {\n const response = await fetch(webhookUrl, options);\n const text = await response.text();\n return text;\n} catch (error) {\n console.error(error);\n return '';\n}"
}
2 changes: 1 addition & 1 deletion packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class App {
// Initialize database
this.AppDataSource.initialize()
.then(async () => {
logger.info('📦 [server]: Data Source is being initialized!')
logger.info('📦 [server]: Data Source is initializing...')

// Run Migrations Scripts
await this.AppDataSource.runMigrations({ transaction: 'each' })
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/views/tools/HowToUseFunctionDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const HowToUseFunctionDialog = ({ show, onCancel }) => {
<ul>
<li style={{ marginTop: 10 }}>You can use any libraries imported in Flowise</li>
<li style={{ marginTop: 10 }}>
You can use properties specified in Output Schema as variables with prefix $:
You can use properties specified in Input Schema as variables with prefix $:
<ul style={{ marginTop: 10 }}>
<li>
Property = <code>userid</code>
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/views/tools/ToolDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from '@/store/actions'

const exampleAPIFunc = `/*
* You can use any libraries imported in Flowise
* You can use properties specified in Output Schema as variables. Ex: Property = userid, Variable = $userid
* You can use properties specified in Input Schema as variables. Ex: Property = userid, Variable = $userid
* You can get default flow config: $flow.sessionId, $flow.chatId, $flow.chatflowId, $flow.input
* You can get custom variables: $vars.<variable-name>
* Must return a string value at the end of function
Expand Down Expand Up @@ -470,8 +470,8 @@ const ToolDialog = ({ show, dialogProps, onUseTemplate, onCancel, onConfirm, set
<Box>
<Stack sx={{ position: 'relative', justifyContent: 'space-between' }} direction='row'>
<Stack sx={{ position: 'relative', alignItems: 'center' }} direction='row'>
<Typography variant='overline'>Output Schema</Typography>
<TooltipWithParser title={'What should be the output response in JSON format?'} />
<Typography variant='overline'>Input Schema</Typography>
<TooltipWithParser title={'What is the input format in JSON?'} />
</Stack>
{dialogProps.type !== 'TEMPLATE' && (
<Button variant='outlined' onClick={addNewRow} startIcon={<IconPlus />}>
Expand All @@ -485,7 +485,7 @@ const ToolDialog = ({ show, dialogProps, onUseTemplate, onCancel, onConfirm, set
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<Stack sx={{ position: 'relative', alignItems: 'center' }} direction='row'>
<Typography variant='overline'>Javascript Function</Typography>
<TooltipWithParser title='Function to execute when tool is being used. You can use properties specified in Output Schema as variables. For example, if the property is <code>userid</code>, you can use as <code>$userid</code>. Return value must be a string. You can also override the code from API by following this <a target="_blank" href="https://docs.flowiseai.com/tools/custom-tool#override-function-from-api">guide</a>' />
<TooltipWithParser title='Function to execute when tool is being used. You can use properties specified in Input Schema as variables. For example, if the property is <code>userid</code>, you can use as <code>$userid</code>. Return value must be a string. You can also override the code from API by following this <a target="_blank" href="https://docs.flowiseai.com/tools/custom-tool#override-function-from-api">guide</a>' />
</Stack>
<Stack direction='row'>
<Button
Expand Down

0 comments on commit 2cadd68

Please sign in to comment.