| 1 | import { |
| 2 | ArrowLeftIcon, |
| 3 | BuildingOfficeIcon, |
| 4 | CircleStackIcon, |
| 5 | Cog6ToothIcon, |
| 6 | CubeIcon, |
| 7 | PencilIcon, |
| 8 | QuestionMarkCircleIcon, |
| 9 | WrenchScrewdriverIcon, |
| 10 | } from "@heroicons/react/24/outline"; |
| 11 | import { BotIcon } from "../../components/svg/BotIcon"; |
| 12 | import { ConfigSection } from "./components/ConfigSection"; |
| 13 | import { AgentsSection } from "./sections/AgentsSection"; |
| 14 | import { HelpSection } from "./sections/HelpSection"; |
| 15 | import { IndexingSettingsSection } from "./sections/IndexingSettingsSection"; |
| 16 | import { ModelsSection } from "./sections/ModelsSection"; |
| 17 | import { OrganizationsSection } from "./sections/OrganizationsSection"; |
| 18 | import { RulesSection } from "./sections/RulesSection"; |
| 19 | import { ToolsSection } from "./sections/ToolsSection"; |
| 20 | import { UserSettingsSection } from "./sections/UserSettingsSection"; |
| 21 | |
| 22 | interface TabOption { |
| 23 | id: string; |
| 24 | label: string; |
| 25 | component: React.ReactNode; |
| 26 | icon: React.ReactNode; |
| 27 | } |
| 28 | |
| 29 | interface TabSection { |
| 30 | id: string; |
| 31 | tabs: TabOption[]; |
| 32 | showTopDivider?: boolean; |
| 33 | showBottomDivider?: boolean; |
| 34 | className?: string; |
| 35 | } |
| 36 | |
| 37 | export const topTabSections: TabSection[] = [ |
| 38 | { |
| 39 | id: "top", |
| 40 | tabs: [ |
| 41 | { |
| 42 | id: "back", |
| 43 | label: "Back", |
| 44 | component: <div />, |
| 45 | icon: <ArrowLeftIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />, |
| 46 | }, |
| 47 | ], |
| 48 | }, |
| 49 | { |
| 50 | id: "blocks", |
| 51 | showTopDivider: true, |
| 52 | tabs: [ |
| 53 | { |
| 54 | id: "models", |
| 55 | label: "Models", |
| 56 | component: ( |
| 57 | <ConfigSection> |
| 58 | <ModelsSection /> |
| 59 | </ConfigSection> |
| 60 | ), |
| 61 | icon: <CubeIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />, |
| 62 | }, |
| 63 | { |
| 64 | id: "rules", |
| 65 | label: "Rules", |
| 66 | component: ( |
| 67 | <ConfigSection> |
| 68 | <RulesSection /> |
| 69 | </ConfigSection> |
| 70 | ), |
| 71 | icon: <PencilIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />, |
| 72 | }, |
| 73 | { |
| 74 | id: "tools", |
| 75 | label: "Tools", |
| 76 | component: ( |
| 77 | <ConfigSection> |
| 78 | <ToolsSection /> |
| 79 | </ConfigSection> |
| 80 | ), |
| 81 | icon: ( |
| 82 | <WrenchScrewdriverIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" /> |
| 83 | ), |
| 84 | }, |
| 85 | ], |
| 86 | }, |
| 87 | { |
| 88 | id: "agents-orgs", |
| 89 | showTopDivider: true, |
| 90 | tabs: [ |
| 91 | { |
| 92 | id: "agents", |
| 93 | label: "Agents", |
| 94 | component: ( |
| 95 | <ConfigSection> |
| 96 | <AgentsSection /> |
| 97 | </ConfigSection> |
| 98 | ), |
| 99 | icon: ( |
| 100 | <BotIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" size={16} /> |
| 101 | ), |
| 102 | }, |
| 103 | { |
| 104 | id: "organizations", |
| 105 | label: "Organizations", |
| 106 | component: ( |
| 107 | <ConfigSection> |
| 108 | <OrganizationsSection /> |
| 109 | </ConfigSection> |
| 110 | ), |
| 111 | icon: ( |
| 112 | <BuildingOfficeIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" /> |
| 113 | ), |
| 114 | }, |
| 115 | ], |
| 116 | }, |
| 117 | { |
| 118 | id: "indexing", |
| 119 | showTopDivider: true, |
| 120 | tabs: [ |
| 121 | { |
| 122 | id: "indexing", |
| 123 | label: "Indexing", |
| 124 | component: ( |
| 125 | <ConfigSection> |
| 126 | <IndexingSettingsSection /> |
| 127 | </ConfigSection> |
| 128 | ), |
| 129 | icon: ( |
| 130 | <CircleStackIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" /> |
| 131 | ), |
| 132 | }, |
| 133 | ], |
| 134 | }, |
| 135 | ]; |
| 136 | |
| 137 | export const bottomTabSections: TabSection[] = [ |
| 138 | { |
| 139 | id: "bottom", |
| 140 | tabs: [ |
| 141 | { |
| 142 | id: "settings", |
| 143 | label: "Settings", |
| 144 | component: ( |
| 145 | <ConfigSection> |
| 146 | <UserSettingsSection /> |
| 147 | </ConfigSection> |
| 148 | ), |
| 149 | icon: <Cog6ToothIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />, |
| 150 | }, |
| 151 | { |
| 152 | id: "help", |
| 153 | label: "Help", |
| 154 | component: ( |
| 155 | <ConfigSection> |
| 156 | <HelpSection /> |
| 157 | </ConfigSection> |
| 158 | ), |
| 159 | icon: ( |
| 160 | <QuestionMarkCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" /> |
| 161 | ), |
| 162 | }, |
| 163 | ], |
| 164 | }, |
| 165 | ]; |
| 166 | |
| 167 | export const getAllTabs = (): TabOption[] => { |
| 168 | return [...topTabSections, ...bottomTabSections].flatMap( |
| 169 | (section) => section.tabs, |
| 170 | ); |
| 171 | }; |