env
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -21,4 +21,4 @@ lerna-debug.log*
|
|||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
backend/.secrets.js
|
backend/.env
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ unzip kongruity.zip
|
|||||||
cd kongruity
|
cd kongruity
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Create a secrets file
|
### 2. Create an environment file
|
||||||
|
|
||||||
The backend expects a `.secrets.js` file containing an Anthropic API key in the root `backend/` directory. This file is git-ignored and must be created manually:
|
The backend expects a `.env` file containing an Anthropic API key in the root `backend/` directory. This file is git-ignored and must be created manually:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo 'export const anthropicApiKey = "<your Anthropic API key>"' > backend/.secrets.js
|
echo 'ANTHROPIC_API_KEY=<your Anthropic API key>' > backend/.env
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `<your Anthropic API key>` with your actual key.
|
Replace `<your Anthropic API key>` with your actual key.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dotenv/config';
|
||||||
import app from './app.js';
|
import app from './app.js';
|
||||||
|
|
||||||
const PORT = process.env.PORT || 3001;
|
const PORT = process.env.PORT || 3001;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import Anthropic from "@anthropic-ai/sdk";
|
import Anthropic from "@anthropic-ai/sdk";
|
||||||
import { anthropicApiKey } from "../.secrets.js";
|
|
||||||
|
|
||||||
const client = new Anthropic({
|
const client = new Anthropic({
|
||||||
apiKey: anthropicApiKey,
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
||||||
});
|
});
|
||||||
|
|
||||||
const buildPrompt = (notes) => {
|
const buildPrompt = (notes) => {
|
||||||
|
|||||||
@@ -14,10 +14,6 @@ vi.mock('@anthropic-ai/sdk', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.mock('../.secrets.js', () => ({
|
|
||||||
anthropicApiKey: 'test-key-not-real',
|
|
||||||
}));
|
|
||||||
|
|
||||||
import { clusterNotes } from '../services/clustering.service.js';
|
import { clusterNotes } from '../services/clustering.service.js';
|
||||||
|
|
||||||
const MOCK_NOTES = [
|
const MOCK_NOTES = [
|
||||||
|
|||||||
Reference in New Issue
Block a user