open the page editor and click on the
"Open Mind" button in the toolbar',
+ 'To get started,
open the page editor and click on the
Open Mind button in the toolbar',
'mind'
),
}}
/>
) : (
- {__('To get started, enter your', 'mind')}
+ {__('To get started,', 'mind')}
{
e.preventDefault();
setActivePage('settings');
}}
>
- {__('OpenAI API key →', 'mind')}
+ {__('select the model and API key →', 'mind')}
)}
diff --git a/src/editor/popup/components/not-connected-screen/index.js b/src/editor/popup/components/not-connected-screen/index.js
index 1a7deea..73f0c11 100644
--- a/src/editor/popup/components/not-connected-screen/index.js
+++ b/src/editor/popup/components/not-connected-screen/index.js
@@ -27,12 +27,12 @@ export default function NotConnectedScreen() {
- {__('OpenAI Key', 'mind')}
+ {__('AI API Key', 'mind')}
{__(
- 'In order to use Mind, you will need to provide your OpenAI API key. Please insert your API key in the plugin settings to get started.',
+ 'In order to use Mind, you will need to provide your Anthropic or OpenAI API key. Please insert your API key in the plugin settings to get started.',
'mind'
)}
@@ -41,6 +41,8 @@ export default function NotConnectedScreen() {
{__('Go to Settings', 'mind')}
diff --git a/src/editor/popup/components/not-connected-screen/style.scss b/src/editor/popup/components/not-connected-screen/style.scss
index ac5faba..85f57d2 100644
--- a/src/editor/popup/components/not-connected-screen/style.scss
+++ b/src/editor/popup/components/not-connected-screen/style.scss
@@ -1,9 +1,5 @@
@import "../../../../mixins/text-gradient";
-.mind-popup-not-connected {
- width: 440px;
-}
-
.mind-popup-connected-screen {
display: flex;
flex-direction: column;
diff --git a/src/utils/is-ai-connected/index.js b/src/utils/is-ai-connected/index.js
new file mode 100644
index 0000000..829ffe7
--- /dev/null
+++ b/src/utils/is-ai-connected/index.js
@@ -0,0 +1,22 @@
+/**
+ * Check if AI is connected
+ * The same function is placed in /classes/class-ai-api.php
+ *
+ * @param {Object} settings Settings object
+ *
+ * @return {boolean} is connected
+ */
+export default function isAIConnected(settings) {
+ const model = settings.ai_model || '';
+ let result = false;
+
+ if (model) {
+ if ('gpt-4o' === model || 'gpt-4o-mini' === model) {
+ result = !!settings?.openai_api_key;
+ } else if (settings?.anthropic_api_key) {
+ result = !!settings?.anthropic_api_key;
+ }
+ }
+
+ return result;
+}
diff --git a/src/utils/is-valid-anthropic-api-key/index.js b/src/utils/is-valid-anthropic-api-key/index.js
new file mode 100644
index 0000000..8f9f85b
--- /dev/null
+++ b/src/utils/is-valid-anthropic-api-key/index.js
@@ -0,0 +1,4 @@
+export default function isValidAnthropicApiKey(apiKey) {
+ const regex = /^sk-ant-[a-zA-Z0-9]/;
+ return regex.test(apiKey);
+}