import type { SlashCommandHandler } from './types' import React from 'react' import { RiFeedbackLine } from '@remixicon/react' import i18n from '@/i18n-config/i18next-config' import { registerCommands, unregisterCommands } from './command-bus' // Feedback command dependency types type FeedbackDeps = Record /** * Feedback command - Opens GitHub feedback discussions */ export const feedbackCommand: SlashCommandHandler = { name: 'feedback', description: 'Open feedback discussions', async search(args: string, locale: string = 'en') { return [{ id: 'feedback', title: i18n.t('common.userProfile.communityFeedback', { lng: locale }), description: i18n.t('app.gotoAnything.actions.feedbackDesc', { lng: locale }) || 'Open community feedback discussions', type: 'command' as const, icon: (
), data: { command: 'navigation.feedback', args: { url: 'https://github.com/langgenius/dify/discussions/categories/feedbacks' } }, }] }, register(_deps: FeedbackDeps) { registerCommands({ 'navigation.feedback': async (args) => { const url = args?.url || 'https://github.com/langgenius/dify/discussions/categories/feedbacks' window.open(url, '_blank', 'noopener,noreferrer') }, }) }, unregister() { unregisterCommands(['navigation.feedback']) }, }