Skip to content

Commit

Permalink
fix: logging
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <danscode@selman.org>
  • Loading branch information
dselman committed Jun 28, 2024
1 parent 4012ac0 commit f5a246b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function run() {
// await graphModel.loadConcertoModels(); // loads models from graph
const context = await graphModel.openSession();

// const tools = graphModel.getTools({chatWithData: true, fullTextSearch: true, getById: true, similaritySearch: true});
// const tools = graphModel.getTools({currentDateTime: true});
// console.log(JSON.stringify(tools, null , 2));

const { session } = context;
Expand Down
14 changes: 8 additions & 6 deletions src/graphmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export class GraphModel {
})
return result;
}) : [];
this.options.logger?.info(`get_${node.getName().toLowerCase()}_by_id`, result);
this.options.logger?.info(`get_${node.getName().toLowerCase()}_by_id`, ret);
return ret;
}
catch (err) {
Expand Down Expand Up @@ -882,9 +882,10 @@ export class GraphModel {
try {
await session.executeWrite(async transaction => {
await this.mergeRelationship(transaction, args.sourceType, args.sourceIdentfiier, args.targetType, args.targetIdentfiier, args.sourcePropertyName);
this.options.logger?.info(`merge_relationship_${node.getName().toLowerCase()}_${relationship.getName().toLowerCase()}`, result);
});
return `created relationship ${relationship.getName()} between source node ${args.sourceIdentfiier} and target node ${args.targetIdentfiier}`;
const ret = `created relationship ${relationship.getName()} between source node ${args.sourceIdentfiier} and target node ${args.targetIdentfiier}`;
this.options.logger?.info(ret);
return ret;
}
catch (err) {
return `An error occurred: ${err}`;
Expand Down Expand Up @@ -913,7 +914,7 @@ export class GraphModel {
"required": ["sourceType", "sourceIdentfiier", "targetType", "targetIdentfiier", "sourcePropertyName"]
}
}
})
});
}

const parameters = this.getToolParameters(node);
Expand All @@ -929,9 +930,10 @@ export class GraphModel {
try {
await session.executeWrite(async transaction => {
await this.mergeNode(transaction, node.getName(), { identifier });
this.options.logger?.info(`add_${node.getName().toLowerCase()}`, result);
});
return `created node ${node.getName()} with identifier ${identifier}`;
const ret = `created node ${node.getName()} with identifier ${identifier}`;
this.options.logger?.info(ret);
return ret;
}
catch (err) {
return `An error occurred: ${err}`;
Expand Down

0 comments on commit f5a246b

Please sign in to comment.