Skip to content

Commit 223a5af

Browse files
committed
feat(org-detection): fix logging issue
1 parent f207c75 commit 223a5af

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/agents/org-detector/agent.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ const githubOrgNameRetrieverTool = (ignoredGithubOrgs, log) => tool(
101101
* Tool #4: Main Content Retriever
102102
* Retrieves the text content found in the `<main>` element of a webpage given its URL
103103
*/
104-
const mainContentRetrieverTool = (apiKey, apiUrl) => tool(
104+
const mainContentRetrieverTool = (apiKey, apiUrl, log) => tool(
105105
async ({ url }) => {
106-
const mainContent = await retrieveMainContent(url, apiKey, apiUrl);
106+
const mainContent = await retrieveMainContent(url, apiKey, apiUrl, log);
107107
return mainContent || '';
108108
},
109109
{
@@ -120,9 +120,9 @@ const mainContentRetrieverTool = (apiKey, apiUrl) => tool(
120120
* Tool #5: Link extractor
121121
* Extracts all links from raw HTML and converts them to absolute URLs
122122
*/
123-
const linkExtractorTool = tool(
123+
const linkExtractorTool = (log) => tool(
124124
async ({ html, domain }) => {
125-
const links = await extractLinks(html, domain);
125+
const links = await extractLinks(html, domain, log);
126126
// Return as a JSON array string
127127
return JSON.stringify(links);
128128
},
@@ -183,11 +183,11 @@ export default class OrgDetectorAgent {
183183

184184
// gather the tools
185185
const tools = [
186-
footerRetrieverTool(spacecatApiKey, spacecatApiBaseUrl),
186+
footerRetrieverTool(spacecatApiKey, spacecatApiBaseUrl, this.log),
187187
companyMatcherTool(dataAccess),
188-
githubOrgNameRetrieverTool(ignoredGithubOrgs),
189-
mainContentRetrieverTool(spacecatApiKey, spacecatApiBaseUrl),
190-
linkExtractorTool,
188+
githubOrgNameRetrieverTool(ignoredGithubOrgs, this.log),
189+
mainContentRetrieverTool(spacecatApiKey, spacecatApiBaseUrl, this.log),
190+
linkExtractorTool(this.log),
191191
];
192192
const toolsNode = new ToolNode(tools);
193193

@@ -243,7 +243,7 @@ export default class OrgDetectorAgent {
243243
return 'tools';
244244
}
245245

246-
this.log('Agent reached to conclusion. Finishing the process');
246+
this.log.info('Agent reached to conclusion. Finishing the process');
247247
return END;
248248
}
249249

0 commit comments

Comments
 (0)