mirror of
https://github.com/langgenius/dify.git
synced 2026-08-30 04:23:20 +08:00
29 lines
872 B
TypeScript
29 lines
872 B
TypeScript
import { useStore as useAppStore } from '@/app/components/app/store'
|
|
import { trackEvent } from '@/app/components/base/amplitude'
|
|
import { AppModeEnum } from '@/types/app'
|
|
|
|
export type AgentScope = (typeof AgentScope)[keyof typeof AgentScope]
|
|
export const AgentScope = {
|
|
InWorkflow: 'in_workflow',
|
|
InChatflow: 'in_chatflow',
|
|
Global: 'global',
|
|
} as const
|
|
|
|
export const useInlineAgentScope = () => {
|
|
const appMode = useAppStore((state) => state.appDetail?.mode)
|
|
|
|
return appMode === AppModeEnum.ADVANCED_CHAT ? AgentScope.InChatflow : AgentScope.InWorkflow
|
|
}
|
|
|
|
export const trackAgentBuildModeRun = (agentScope: AgentScope) => {
|
|
return trackEvent('agent_build_mode_run', {
|
|
agent_scope: agentScope,
|
|
})
|
|
}
|
|
|
|
export const trackAgentPreviewModeRun = (agentScope: AgentScope) => {
|
|
return trackEvent('agent_preview_mode_run', {
|
|
agent_scope: agentScope,
|
|
})
|
|
}
|