const fs = require('fs'); const file = 'app/(admin)/admin/settings/admin-settings-form.tsx'; let content = fs.readFileSync(file, 'utf-8'); // 1. Add state variable content = content.replace( "const { t } = useLanguage()", "const { t } = useLanguage()\n const [activeAiTab, setActiveAiTab] = useState<'tags' | 'embeddings' | 'chat'>('tags')" ); // 2. Add Tab Switcher UI and wrap each block // Find the start of AI form const aiFormStart = `
{/* Tags Generation Provider */}
`; const newAiFormStart = `
{/* Tags Generation Provider */}
`; content = content.replace(aiFormStart, newAiFormStart); // Now find Embeddings and Chat and wrap them in hidden condition const embeddingsStart = `{/* Embeddings Provider */}
`; const newEmbeddingsStart = `{/* Embeddings Provider */}
`; content = content.replace(embeddingsStart, newEmbeddingsStart); const chatStart = `{/* Chat Provider */}
`; const newChatStart = `{/* Chat Provider */}
`; content = content.replace(chatStart, newChatStart); // 3. Fix button overflows everywhere. // Find:
(AI) content = content.replace( '
', '
' ); // Find:
(Email, Tools, Security?) // Tools: content = content.replace( '
', '
' ); content = content.replace( '
', '
' ); // Email: content = content.replace( '
', '
' ); // Security doesn't have justify-between, it just has
// Write back fs.writeFileSync(file, content); console.log("Done");