Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd284e3459 | ||
|
|
41bf2ce638 | ||
|
|
bfb3e4a07e |
@@ -3,7 +3,7 @@ import { createDeepAgent } from "deepagents";
|
|||||||
import { AIMessageChunk, ToolMessage, todoListMiddleware } from "langchain";
|
import { AIMessageChunk, ToolMessage, todoListMiddleware } from "langchain";
|
||||||
import { HumanMessage } from "@langchain/core/messages";
|
import { HumanMessage } from "@langchain/core/messages";
|
||||||
import { ChatDeepSeek } from "@langchain/deepseek";
|
import { ChatDeepSeek } from "@langchain/deepseek";
|
||||||
import config from '../../../conf.json' with { type: 'json' };
|
import config from '../../../config.js';
|
||||||
import logger from '../../../utils/logger.js';
|
import logger from '../../../utils/logger.js';
|
||||||
import { createRestrictedBackend } from "../../infra/restricted_fs_backend.js";
|
import { createRestrictedBackend } from "../../infra/restricted_fs_backend.js";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ChatOpenAI } from "@langchain/openai";
|
|||||||
import { AIMessageChunk, ToolMessage } from "langchain";
|
import { AIMessageChunk, ToolMessage } from "langchain";
|
||||||
import { HumanMessage } from "@langchain/core/messages";
|
import { HumanMessage } from "@langchain/core/messages";
|
||||||
import { ChatDeepSeek } from "@langchain/deepseek";
|
import { ChatDeepSeek } from "@langchain/deepseek";
|
||||||
import config from '../../../conf.json' with { type: 'json' };
|
import config from '../../../config.js';
|
||||||
import logger from '../../../utils/logger.js';
|
import logger from '../../../utils/logger.js';
|
||||||
|
|
||||||
// 密钥由 conf.json 统一提供;百度地图 skill 通过 env_get 读环境变量,此处桥接
|
// 密钥由 conf.json 统一提供;百度地图 skill 通过 env_get 读环境变量,此处桥接
|
||||||
@@ -160,22 +160,19 @@ export default class EscortAgent {
|
|||||||
return this.agent;
|
return this.agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 受限后端:锁定沙箱根并禁止读取 conf.json/.env/logs 及用户数据目录
|
// 受限后端:锁定沙箱根并禁止读取 conf.json/.env/logs 及用户数据目录;
|
||||||
let backend = createRestrictedBackend({ rootDir, dataDir });
|
// 登录用户挂载 /memories/ ↔ data/users/{userId}/(/memories/memory.txt ↔ .../memory.txt)
|
||||||
|
const backend = userInfo
|
||||||
if (userInfo) {
|
? new CompositeBackend(
|
||||||
// 挂载根为用户数据目录:/memories/memory.txt ↔ data/users/{userId}/memory.txt
|
createRestrictedBackend({ rootDir, dataDir }),
|
||||||
const userMemoryRoot = path.join(dataDir, "users", userInfo._id);
|
{
|
||||||
backend = new CompositeBackend(
|
"/memories/": new FilesystemBackend({
|
||||||
createRestrictedBackend({ rootDir, dataDir }),
|
rootDir: path.join(dataDir, "users", userInfo._id),
|
||||||
{
|
virtualMode: true
|
||||||
"/memories/": new FilesystemBackend({
|
})
|
||||||
rootDir: userMemoryRoot,
|
},
|
||||||
virtualMode: true
|
)
|
||||||
})
|
: createRestrictedBackend({ rootDir, dataDir });
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.flashModel = new ChatDeepSeek({
|
this.flashModel = new ChatDeepSeek({
|
||||||
model: config.agent.deepseek.flashModel,
|
model: config.agent.deepseek.flashModel,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import config from "../../../conf.json" with { type: 'json' };
|
import config from "../../../config.js";
|
||||||
import services from "../../../resource/services.js";
|
import services from "../../../resource/services.js";
|
||||||
import agreement from "../../../resource/agreement.js";
|
import agreement from "../../../resource/agreement.js";
|
||||||
import logger from "../../../utils/logger.js";
|
import logger from "../../../utils/logger.js";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { TavilyExtract } from "@langchain/tavily";
|
import { TavilyExtract } from "@langchain/tavily";
|
||||||
import { tool } from "@langchain/core/tools";
|
import { tool } from "@langchain/core/tools";
|
||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
import config from "../../../../conf.json" with { type: "json" };
|
import config from "../../../../config.js";
|
||||||
|
|
||||||
const webFetchTool = tool(
|
const webFetchTool = tool(
|
||||||
async ({
|
async ({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { TavilySearch } from "@langchain/tavily";
|
import { TavilySearch } from "@langchain/tavily";
|
||||||
import { tool } from "@langchain/core/tools";
|
import { tool } from "@langchain/core/tools";
|
||||||
import * as z from "zod"
|
import * as z from "zod"
|
||||||
import config from "../../../../conf.json" with { type: "json" };
|
import config from "../../../../config.js";
|
||||||
|
|
||||||
const webSearchTool = tool(
|
const webSearchTool = tool(
|
||||||
async ({
|
async ({
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"model": "deepseek",
|
"model": "deepseek",
|
||||||
"deepseek": {
|
"deepseek": {
|
||||||
"apiKey": "sk-a58ccd82b7ba4ce3ac176a88c9381095",
|
"apiKey": "sk-a58ccd82b7ba4ce3ac176a88c9381095",
|
||||||
"flashModel": "deepseek-v4-flash",
|
"flashModel": "deepseek-flash",
|
||||||
"proModel": "deepseek-v4-pro"
|
"proModel": "deepseek-v4-pro"
|
||||||
},
|
},
|
||||||
"glm": {
|
"glm": {
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { existsSync, readFileSync } from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
// 优先读取系统级配置,其次读取项目目录下的配置
|
||||||
|
const SYSTEM_CONF = '/etc/ehason/conf.json';
|
||||||
|
const LOCAL_CONF = path.join(__dirname, 'conf.json');
|
||||||
|
|
||||||
|
function loadConfig() {
|
||||||
|
const file = existsSync(SYSTEM_CONF) ? SYSTEM_CONF : LOCAL_CONF;
|
||||||
|
return JSON.parse(readFileSync(file, 'utf-8'));
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = loadConfig();
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import { EscortRecordSchema } from "./schema/escort_record.js"
|
|||||||
import { HealthProfileSchema } from "./schema/health_profile.js"
|
import { HealthProfileSchema } from "./schema/health_profile.js"
|
||||||
import { OrganizationSchema } from "./schema/organization.js"
|
import { OrganizationSchema } from "./schema/organization.js"
|
||||||
import { EmployeeSchema } from "./schema/employee.js"
|
import { EmployeeSchema } from "./schema/employee.js"
|
||||||
import config from '../conf.json' with { type: 'json' };
|
import config from '../config.js';
|
||||||
import logger from '../utils/logger.js';
|
import logger from '../utils/logger.js';
|
||||||
|
|
||||||
class MongoDBSchema {
|
class MongoDBSchema {
|
||||||
|
|||||||
Generated
-23
@@ -2339,29 +2339,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/only/-/only-0.0.2.tgz",
|
"resolved": "https://registry.npmmirror.com/only/-/only-0.0.2.tgz",
|
||||||
"integrity": "sha512-Fvw+Jemq5fjjyWz6CpKx6w9s7xxqo3+JCyM0WXWeCSOboZ8ABkyvP8ID4CZuChA/wxSx+XSJmdOm8rGVyJ1hdQ=="
|
"integrity": "sha512-Fvw+Jemq5fjjyWz6CpKx6w9s7xxqo3+JCyM0WXWeCSOboZ8ABkyvP8ID4CZuChA/wxSx+XSJmdOm8rGVyJ1hdQ=="
|
||||||
},
|
},
|
||||||
"node_modules/openai": {
|
|
||||||
"version": "6.38.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/openai/-/openai-6.38.0.tgz",
|
|
||||||
"integrity": "sha512-AoMplt2UalrpgUDMh3L09QWjNRlgJPipclQvA6sYAaeF6nHNBMgmikAZGmcYLn8on4d9sQY9Q8bOLfrBS7Lc8g==",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"optional": true,
|
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
|
||||||
"openai": "bin/cli"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"ws": "^8.18.0",
|
|
||||||
"zod": "^3.25 || ^4.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"ws": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"zod": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/p-finally": {
|
"node_modules/p-finally": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/p-finally/-/p-finally-1.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/p-finally/-/p-finally-1.0.0.tgz",
|
||||||
|
|||||||
Reference in New Issue
Block a user