Add Google AI Support & Refactor AI Provider Settings#101
Open
skorphil wants to merge 13 commits into
Open
Conversation
…emini prompts - Add `obsidianFetch` utility to wrap Obsidian's `requestUrl`, bypassing CORS restrictions for OpenAI-compatible providers. - Integrate `obsidianFetch`
…schemas - Update `llmFixMermaidChartGemini` to use explicit HumanMessage and enforce real newline characters in the output. - Add debug logging to Gemini summarization and mermaid chart fixing functions. - Modify `obsidianFetch` to strip `$schema` and `title` from JSON schemas to ensure compatibility with providers like Groq. - Remove unused
Introduce `migrateSettings` to handle updates to the plugin configuration structure, ensuring backward compatibility when loading saved user data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@Mikodin I can't test with OpenAI, because i have no money there. I tested only to the moment when error
insufficient fundsbeing returned. I re-introduced custom fetcher and it seems working (it fixes CORS issues with custom openAI providers). For gemini - separate langchain adapter is used. However I didn't integrate gemini transcription yet.related to #81 and #54
Summary
This PR adds Google AI (Gemini) support as an alternative processing provider and refactors the AI provider settings architecture for better maintainability and extensibility. The changes enable users to choose between OpenAI, Google AI, and custom OpenAI-compatible endpoints for transcription and LLM processing.
Key Changes
🆕 Google AI Support
src/util/geminiAiUtils.tssummarizeTranscriptGemini()for transcript summarization using Google's Gemini modelsllmFixMermaidChartGemini()for mermaid chart repairLLM_MODELSenum with available Gemini models (gemini-2.5-pro, gemini-2.5-flash, etc.)googleAiApiKeyandgoogleModeltoScribePluginSettings@langchain/google-genaipackage🔧 Obsidian Fetcher (CORS Fix)
src/util/obsidianFetch.tsrequestUrl()APIdata:URLs, and request/response conversionChatOpenAIconfigurations🏗️ Settings Architecture Refactor
AiModelSettings.tsxwith modular settings structure:ai-provider-settings-tab/folder with:ProviderSettingsTab.tsx- Main tab with platform selectorsProviderSettingsSections.tsx- Modular sections per provider (OpenAI, Gemini, Custom)index.ts- Re-exportsPROCESS_PLATFORM:openAi,google,customOpenAiTRANSCRIPT_PLATFORM: AddedcustomOpenAioptionuseCustomOpenAiBaseUrlboolean (replaced byprocessPlatformenum)src/settings/migration.tsdetects the olduseCustomOpenAiBaseUrl: trueflag and automatically setsprocessPlatformandtranscriptPlatformtocustomOpenAion first load — no manual reconfiguration needed⚡ Core Logic Refactoring (
src/index.ts)🛠️ Other Improvements
skipLibCheck: truetotsconfig.jsonto prevent type errors from dependenciescontrolModalTesting Checklist
Breaking Changes
useCustomOpenAiBaseUrlboolean setting is removed and replaced with theprocessPlatformenum. Existing settings are automatically migrated on first load — base URL, API key, and custom model names are preserved as-is.Future plans
mermaidPlatform