({ APIkey, setCurrentKey })
| 10 | import { useIndexContext } from 'renderer/context/IndexContext'; |
| 11 | |
| 12 | export default function AISettingTabs({ APIkey, setCurrentKey }) { |
| 13 | const { |
| 14 | prompt, |
| 15 | setPrompt, |
| 16 | updateSettings, |
| 17 | setBaseUrl, |
| 18 | getKey, |
| 19 | setKey, |
| 20 | deleteKey, |
| 21 | model, |
| 22 | setModel, |
| 23 | embeddingModel, |
| 24 | setEmbeddingModel, |
| 25 | ollama, |
| 26 | baseUrl, |
| 27 | pileAIProvider, |
| 28 | setPileAIProvider, |
| 29 | } = useAIContext(); |
| 30 | |
| 31 | const { currentTheme, setTheme } = usePilesContext(); |
| 32 | |
| 33 | const handleTabChange = (newValue) => { |
| 34 | setPileAIProvider(newValue); |
| 35 | }; |
| 36 | |
| 37 | const handleInputChange = (setter) => (e) => setter(e.target.value); |
| 38 | |
| 39 | const renderThemes = () => { |
| 40 | return Object.entries(availableThemes).map(([theme, colors]) => ( |
| 41 | <button |
| 42 | key={`theme-${theme}`} |
| 43 | className={`${styles.theme} ${ |
| 44 | currentTheme === theme ? styles.current : '' |
| 45 | }`} |
| 46 | onClick={() => setTheme(theme)} |
| 47 | > |
| 48 | <div |
| 49 | className={styles.color1} |
| 50 | style={{ background: colors.primary }} |
| 51 | ></div> |
| 52 | </button> |
| 53 | )); |
| 54 | }; |
| 55 | |
| 56 | return ( |
| 57 | <Tabs.Root |
| 58 | className={styles.tabsRoot} |
| 59 | defaultValue="openai" |
| 60 | value={pileAIProvider} |
| 61 | onValueChange={handleTabChange} |
| 62 | > |
| 63 | <Tabs.List className={styles.tabsList} aria-label="Manage your account"> |
| 64 | <Tabs.Trigger |
| 65 | className={`${styles.tabsTrigger} ${ |
| 66 | pileAIProvider === 'ollama' ? styles.activeCenter : '' |
| 67 | } ${pileAIProvider === 'openai' ? styles.activeRight : ''}`} |
| 68 | value="subscription" |
| 69 | > |
nothing calls this directly
no test coverage detected