@receptron/graphai_express 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/graph.js +3 -3
- package/lib/type.d.ts +1 -1
- package/package.json +3 -3
package/lib/graph.js
CHANGED
|
@@ -37,7 +37,7 @@ const streamGraphRunner = (agentDictionary, agentFilters = [], streamChunkCallba
|
|
|
37
37
|
};
|
|
38
38
|
const filterList = [...agentFilters, streamAgentFilter];
|
|
39
39
|
const dispatcher = streamGraphRunnerInternal(agentDictionary, filterList);
|
|
40
|
-
const result = await dispatcher(req
|
|
40
|
+
const result = await dispatcher(req);
|
|
41
41
|
const json_data = JSON.stringify(result);
|
|
42
42
|
res.write("___END___");
|
|
43
43
|
res.write(json_data);
|
|
@@ -53,7 +53,7 @@ const nonStreamGraphRunner = (agentDictionary, agentFilters = []) => {
|
|
|
53
53
|
return async (req, res, next) => {
|
|
54
54
|
try {
|
|
55
55
|
const dispatcher = streamGraphRunnerInternal(agentDictionary, agentFilters);
|
|
56
|
-
const result = await dispatcher(req
|
|
56
|
+
const result = await dispatcher(req);
|
|
57
57
|
return res.json(result);
|
|
58
58
|
}
|
|
59
59
|
catch (e) {
|
|
@@ -64,7 +64,7 @@ const nonStreamGraphRunner = (agentDictionary, agentFilters = []) => {
|
|
|
64
64
|
exports.nonStreamGraphRunner = nonStreamGraphRunner;
|
|
65
65
|
// internal function
|
|
66
66
|
const streamGraphRunnerInternal = (agentDictionary, agentFilters = []) => {
|
|
67
|
-
return async (req
|
|
67
|
+
return async (req) => {
|
|
68
68
|
const { graphData } = req.body;
|
|
69
69
|
const { config } = req;
|
|
70
70
|
const graphai = new graphai_1.GraphAI(graphData, agentDictionary, { agentFilters, config: config ?? {} });
|
package/lib/type.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export type ExpressAgentInfo = {
|
|
|
13
13
|
output: any;
|
|
14
14
|
stream: boolean;
|
|
15
15
|
};
|
|
16
|
-
export type StreamChunkCallback = (context: AgentFunctionContext, token: string) => void;
|
|
16
|
+
export type StreamChunkCallback = (context: AgentFunctionContext, token: string | Record<string, string>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@receptron/graphai_express",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "GraphAI express web server middleware.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"server": "ts-node -r tsconfig-paths/register test/express.ts",
|
|
13
13
|
"test_stream": "ts-node -r tsconfig-paths/register test/stream_client.ts",
|
|
14
14
|
"test_stream2": "ts-node -r tsconfig-paths/register test/stream_graph.ts",
|
|
15
|
-
"test": "
|
|
15
|
+
"test": "node --test -r tsconfig-paths/register --require ts-node/register ./test/test_*.ts",
|
|
16
16
|
"format": "prettier --write '{src,test}/**/*.{yaml,ts,json}'",
|
|
17
17
|
"ci": "yarn run format && yarn run eslint && yarn run build"
|
|
18
18
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@graphai/agent_filters": "^0.0.6",
|
|
47
47
|
"dotenv": "^16.4.5",
|
|
48
48
|
"express": "^4.19.2",
|
|
49
|
-
"graphai": "^0.5.
|
|
49
|
+
"graphai": "^0.5.6"
|
|
50
50
|
},
|
|
51
51
|
"types": "./lib/index.d.ts",
|
|
52
52
|
"directories": {
|