mirror of
https://github.com/dzhng/deep-research.git
synced 2026-03-22 07:57:16 +08:00
@@ -3,3 +3,7 @@ FIRECRAWL_KEY="YOUR_KEY"
|
||||
# FIRECRAWL_BASE_URL="http://localhost:3002"
|
||||
|
||||
OPENAI_KEY="YOUR_KEY"
|
||||
CONTEXT_SIZE="128000"
|
||||
# If you want to use other OpenAI compatible API, add the following below:
|
||||
# OPENAI_ENDPOINT="http://localhost:11434/v1"
|
||||
# OPENAI_MODEL="llama3.1"
|
||||
|
||||
@@ -3,10 +3,9 @@ FROM node:18-alpine
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
COPY package.json.docker ./package.json
|
||||
COPY package.json ./
|
||||
COPY .env.local ./.env.local
|
||||
|
||||
RUN npm install
|
||||
|
||||
|
||||
CMD ["npm", "start"]
|
||||
CMD ["npm", "run", "docker"]
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
||||
"tsx": "tsx --env-file=.env.local",
|
||||
"start": "tsx --env-file=.env.local src/run.ts",
|
||||
"docker": "tsx src/run.ts",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "open-deep-research",
|
||||
"version": "0.0.1",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
||||
"tsx": "tsx --env-file=.env.local",
|
||||
"start": "tsx src/run.ts",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": "",
|
||||
"devDependencies": {
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.13.0",
|
||||
"prettier": "^3.4.2",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/openai": "^1.1.9",
|
||||
"@mendable/firecrawl-js": "^1.16.0",
|
||||
"ai": "^4.1.17",
|
||||
"js-tiktoken": "^1.0.17",
|
||||
"lodash-es": "^4.17.21",
|
||||
"p-limit": "^6.2.0",
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22.x"
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,19 @@ const openai = createOpenAI({
|
||||
} as CustomOpenAIProviderSettings);
|
||||
|
||||
const isCustomEndpoint =
|
||||
process.env.OPENAI_ENDPOINT && process.env.OPENAI_ENDPOINT !== 'https://api.openai.com/v1';
|
||||
process.env.OPENAI_ENDPOINT &&
|
||||
process.env.OPENAI_ENDPOINT !== 'https://api.openai.com/v1';
|
||||
const customModel = process.env.OPENAI_MODEL;
|
||||
|
||||
// Models
|
||||
|
||||
export const o3MiniModel = openai(isCustomEndpoint && customModel ? customModel : 'o3-mini', {
|
||||
reasoningEffort: 'medium',
|
||||
structuredOutputs: true,
|
||||
});
|
||||
export const o3MiniModel = openai(
|
||||
isCustomEndpoint && customModel ? customModel : 'o3-mini',
|
||||
{
|
||||
reasoningEffort: 'medium',
|
||||
structuredOutputs: true,
|
||||
},
|
||||
);
|
||||
|
||||
const MinChunkSize = 140;
|
||||
const encoder = getEncoding('o200k_base');
|
||||
|
||||
16
src/run.ts
16
src/run.ts
@@ -25,9 +25,17 @@ async function run() {
|
||||
|
||||
// Get breath and depth parameters
|
||||
const breadth =
|
||||
parseInt(await askQuestion('Enter research breadth (recommended 2-10, default 4): '), 10) || 4;
|
||||
parseInt(
|
||||
await askQuestion(
|
||||
'Enter research breadth (recommended 2-10, default 4): ',
|
||||
),
|
||||
10,
|
||||
) || 4;
|
||||
const depth =
|
||||
parseInt(await askQuestion('Enter research depth (recommended 1-5, default 2): '), 10) || 2;
|
||||
parseInt(
|
||||
await askQuestion('Enter research depth (recommended 1-5, default 2): '),
|
||||
10,
|
||||
) || 2;
|
||||
|
||||
console.log(`Creating research plan...`);
|
||||
|
||||
@@ -63,7 +71,9 @@ ${followUpQuestions.map((q, i) => `Q: ${q}\nA: ${answers[i]}`).join('\n')}
|
||||
});
|
||||
|
||||
console.log(`\n\nLearnings:\n\n${learnings.join('\n')}`);
|
||||
console.log(`\n\nVisited URLs (${visitedUrls.length}):\n\n${visitedUrls.join('\n')}`);
|
||||
console.log(
|
||||
`\n\nVisited URLs (${visitedUrls.length}):\n\n${visitedUrls.join('\n')}`,
|
||||
);
|
||||
console.log('Writing final report...');
|
||||
|
||||
const report = await writeFinalReport({
|
||||
|
||||
Reference in New Issue
Block a user