mirror of https://github.com/langgenius/dify.git
feat: use @banana
This commit is contained in:
parent
5705fa898f
commit
336769deb1
|
|
@ -12,7 +12,6 @@ import { forumCommand } from './forum'
|
|||
import { languageCommand } from './language'
|
||||
import { slashCommandRegistry } from './registry'
|
||||
import { themeCommand } from './theme'
|
||||
import { vibeCommand } from './vibe'
|
||||
import { zenCommand } from './zen'
|
||||
|
||||
export const slashAction: ActionItem = {
|
||||
|
|
@ -42,7 +41,6 @@ export const registerSlashCommands = (deps: Record<string, any>) => {
|
|||
slashCommandRegistry.register(communityCommand, {})
|
||||
slashCommandRegistry.register(accountCommand, {})
|
||||
slashCommandRegistry.register(zenCommand, {})
|
||||
slashCommandRegistry.register(vibeCommand, {})
|
||||
}
|
||||
|
||||
export const unregisterSlashCommands = () => {
|
||||
|
|
@ -54,7 +52,6 @@ export const unregisterSlashCommands = () => {
|
|||
slashCommandRegistry.unregister('community')
|
||||
slashCommandRegistry.unregister('account')
|
||||
slashCommandRegistry.unregister('zen')
|
||||
slashCommandRegistry.unregister('vibe')
|
||||
}
|
||||
|
||||
export const SlashCommandProvider = () => {
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@
|
|||
|
||||
import type { ActionItem, SearchResult } from './types'
|
||||
import { appAction } from './app'
|
||||
import { bananaAction } from './banana'
|
||||
import { slashAction } from './commands'
|
||||
import { slashCommandRegistry } from './commands/registry'
|
||||
import { knowledgeAction } from './knowledge'
|
||||
|
|
@ -191,6 +192,7 @@ export const createActions = (isWorkflowPage: boolean, isRagPipelinePage: boolea
|
|||
else if (isWorkflowPage) {
|
||||
return {
|
||||
...baseActions,
|
||||
banana: bananaAction,
|
||||
node: workflowNodesAction,
|
||||
}
|
||||
}
|
||||
|
|
@ -205,6 +207,7 @@ export const Actions = {
|
|||
app: appAction,
|
||||
knowledge: knowledgeAction,
|
||||
plugin: pluginAction,
|
||||
banana: bananaAction,
|
||||
node: workflowNodesAction,
|
||||
}
|
||||
|
||||
|
|
@ -296,4 +299,4 @@ export const matchAction = (query: string, actions: Record<string, ActionItem>)
|
|||
|
||||
export * from './commands'
|
||||
export * from './types'
|
||||
export { appAction, knowledgeAction, pluginAction, workflowNodesAction }
|
||||
export { appAction, bananaAction, knowledgeAction, pluginAction, workflowNodesAction }
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export type CommandSearchResult = {
|
|||
export type SearchResult = AppSearchResult | PluginSearchResult | KnowledgeSearchResult | WorkflowNodeSearchResult | CommandSearchResult
|
||||
|
||||
export type ActionItem = {
|
||||
key: '@app' | '@knowledge' | '@plugin' | '@node' | '/'
|
||||
key: '@app' | '@banana' | '@knowledge' | '@plugin' | '@node' | '/'
|
||||
shortcut: string
|
||||
title: string | TypeWithI18N
|
||||
description: string
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, co
|
|||
'@plugin': 'app.gotoAnything.actions.searchPluginsDesc',
|
||||
'@knowledge': 'app.gotoAnything.actions.searchKnowledgeBasesDesc',
|
||||
'@node': 'app.gotoAnything.actions.searchWorkflowNodesDesc',
|
||||
'@banana': 'app.gotoAnything.actions.vibeDesc',
|
||||
}
|
||||
return t(keyMap[item.key] as any) as string
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import Input from '@/app/components/base/input'
|
||||
import Modal from '@/app/components/base/modal'
|
||||
import { VIBE_COMMAND_EVENT } from '@/app/components/workflow/constants'
|
||||
import { getKeyboardKeyCodeBySystem, isEventTargetInputArea, isMac } from '@/app/components/workflow/utils/common'
|
||||
import { selectWorkflowNode } from '@/app/components/workflow/utils/node-navigation'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
|
|
@ -158,6 +159,13 @@ const GotoAnything: FC<Props> = ({
|
|||
|
||||
switch (result.type) {
|
||||
case 'command': {
|
||||
if (result.data.command === 'workflow.vibe') {
|
||||
if (typeof document !== 'undefined') {
|
||||
document.dispatchEvent(new CustomEvent(VIBE_COMMAND_EVENT, { detail: { dsl: result.data.args?.dsl } }))
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
// Execute slash commands
|
||||
const action = Actions.slash
|
||||
action?.action?.(result)
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ const translation = {
|
|||
feedbackDesc: 'Open community feedback discussions',
|
||||
zenTitle: 'Zen Mode',
|
||||
zenDesc: 'Toggle canvas focus mode',
|
||||
vibeTitle: 'Vibe Workflow',
|
||||
vibeTitle: 'Banana Workflow',
|
||||
vibeDesc: 'Generate a workflow from natural language',
|
||||
vibeHint: 'Describe the workflow, e.g. "{{prompt}}"',
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue