From 113a8ed4d2954c005f857e48167155afc47b2636 Mon Sep 17 00:00:00 2001 From: Tisats <61549618+Tisats@users.noreply.github.com> Date: Wed, 11 Jun 2025 09:00:31 +0100 Subject: [PATCH] Updated for compatibility with prod Plugin is now agnostic between Rightbrain staging and production environments. Updated README for production environment and to encourage use of Obsidians graph features. --- README.md | 5 +++-- main.ts | 15 +++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6ba329b..7738705 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This plugin is deeply integrated with [RightBrain.ai](https://rightbrain.ai) to **2. Create your RightBrain API Client** -* Navigate to your RightBrain API Clients page: [https://stag.leftbrain.me/preferences?tab=api-clients](https://stag.leftbrain.me/preferences?tab=api-clients). +* Navigate to your RightBrain API Clients page: [https://app.rightbrain.ai/preferences?tab=api-clients](https://app.rightbrain.ai/preferences?tab=api-clients). * Click **Create OAuth Client**. * Give it a descriptive name (e.g., "Obsidian Plugin"). * For "Token Endpoint Auth Method," select **Client Secret Basic (client_credentials)**. @@ -65,6 +65,7 @@ Please be aware that your `Client Secret` is stored in plaintext in this file. T * **Handle Difficult Sources:** Some subprocessor lists are buried in PDFs, hard-to-parse web pages, or not publicly available at all. The **`Manually Add Subprocessor List URL`** and **`Input Subprocessor List from Text`** features allow you to point the AI directly at a URL or simply paste the text to ensure nothing is missed. * **AI-Powered Verification & Extraction:** Uses RightBrain to verify if a URL is a genuine, current subprocessor list and then extracts the names of all third-party vendors and internal company affiliates. * **Automated Note Creation & Linking:** Creates a central, linked note for each processor and subprocessor. A processor's note lists its subprocessors; a subprocessor's note lists who it's "Used By." +* **Visualize Your Supply Chain:** Because all notes are inter-linked, you can use Obsidian's native Graph View to get an instant, interactive map of your vendor relationships. This makes complex data supply chains easier to understand and allows you to dive in and out of particular nodes of interest. * **AI-Powered Deduplication:** Run a command on your processors folder to find and merge duplicate entities, combining their relationships automatically. * **Compliance Document Enrichment:** Right-click any processor file to automatically find and link to that company's public DPA, Terms of Service, and Security pages. @@ -94,7 +95,7 @@ Please be aware that your `Client Secret` is stored in plaintext in this file. T ### 🌱 Future Development & Feedback -This is the first release of Processor Processor. The "Enrich" features are just the beginning of a larger plan to build a suite of automated due diligence tools. +This is the first release of Processor Processor. The "Enrich" features are just the beginning of a larger plan to build a suite of automated due diligence tools. I am also actively exploring enhancements to the graph visualization to make these relationship maps even more powerful. Your feedback is invaluable for guiding what comes next! If you have ideas for new features or improvements, please share them by raising an issue on the plugin's GitHub repository. diff --git a/main.ts b/main.ts index 443757e..257d34e 100644 --- a/main.ts +++ b/main.ts @@ -18,6 +18,8 @@ interface ProcessorProcessorSettings { rightbrainClientSecret: string; rightbrainOrgId: string; rightbrainProjectId: string; + rightbrainApiUrl: string; + rightbrainOauth2Url: string; rightbrainVerifyUrlTaskId: string; rightbrainExtractEntitiesTaskId: string; rightbrainExtractInputField: string; @@ -43,6 +45,8 @@ const DEFAULT_SETTINGS: ProcessorProcessorSettings = { rightbrainClientSecret: '', rightbrainOrgId: '', rightbrainProjectId: '', + rightbrainApiUrl: 'https://app.rightbrain.ai/api/v1', + rightbrainOauth2Url: 'https://oauth.rightbrain.ai', rightbrainVerifyUrlTaskId: '', rightbrainExtractEntitiesTaskId: '', rightbrainExtractInputField: 'page_text', @@ -533,7 +537,7 @@ export default class ProcessorProcessorPlugin extends Plugin { new Notice("RightBrain Org ID or Project ID not set."); return null; } - const tasksUrl = `https://stag.leftbrain.me/api/v1/org/${this.settings.rightbrainOrgId}/project/${this.settings.rightbrainProjectId}/task`; + const tasksUrl = `${this.settings.rightbrainApiUrl}/org/${this.settings.rightbrainOrgId}/project/${this.settings.rightbrainProjectId}/task`; const headers = { 'Authorization': `Bearer ${rbToken}` }; try { @@ -558,7 +562,7 @@ export default class ProcessorProcessorPlugin extends Plugin { * @returns The created task object or null if an error occurs. */ private async createRightBrainTask(rbToken: string, taskDefinition: any): Promise { - const createUrl = `https://stag.leftbrain.me/api/v1/org/${this.settings.rightbrainOrgId}/project/${this.settings.rightbrainProjectId}/task`; + const createUrl = `${this.settings.rightbrainApiUrl}/org/${this.settings.rightbrainOrgId}/project/${this.settings.rightbrainProjectId}/task`; const headers = { 'Authorization': `Bearer ${rbToken}`, 'Content-Type': 'application/json' @@ -1468,8 +1472,8 @@ export default class ProcessorProcessorPlugin extends Plugin { return (this as any)._rbToken; } - const tokenUrl = 'https://oauth.leftbrain.me/oauth2/token'; // Corrected based on PDF - + const tokenUrl = `${this.settings.rightbrainOauth2Url}/oauth2/token`; + const bodyParams = new URLSearchParams(); bodyParams.append('grant_type', 'client_credentials'); @@ -1747,8 +1751,7 @@ export default class ProcessorProcessorPlugin extends Plugin { return null; } - const taskRunUrl = `https://stag.leftbrain.me/api/v1/org/${this.settings.rightbrainOrgId}/project/${this.settings.rightbrainProjectId}/task/${taskId}/run`; - const headers = { + const taskRunUrl = `${this.settings.rightbrainApiUrl}/org/${this.settings.rightbrainOrgId}/project/${this.settings.rightbrainProjectId}/task/${taskId}/run`; const headers = { 'Authorization': `Bearer ${rbToken}`, 'Content-Type': 'application/json', 'User-Agent': `ObsidianProcessorProcessorPlugin/${this.manifest.version}`