Skip to content

Commit 20a5c29

Browse files
Merge pull request #112 from SmythOS/dev
APICall + AgentLog hotfix
2 parents 653b7ad + 05f1c90 commit 20a5c29

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@smythos/sre",
3-
"version": "1.5.53",
3+
"version": "1.5.54",
44
"description": "Smyth Runtime Environment",
55
"author": "Alaa-eddine KADDOURI",
66
"license": "MIT",

packages/core/src/Components/APICall/APICall.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class APICall extends Component {
115115
let _error: any = undefined;
116116
try {
117117
// To support both old and new OAuth configuration, we check for both oauth_con_id and oauthService.
118-
if ((config?.data?.oauth_con_id !== '' && config?.data?.oauth_con_id !== 'None') || (config?.data?.oauthService !== '' && config.data.oauthService !== 'None')) {
118+
if ((config?.data?.oauth_con_id !== undefined && config?.data?.oauth_con_id !== '' && config?.data?.oauth_con_id !== 'None') || (config?.data?.oauthService !== '' && config.data.oauthService !== 'None')) {
119119
const additionalParams = extractAdditionalParamsForOAuth1(reqConfig);
120120
const oauthHeaders = await generateOAuthHeaders(agent, config, reqConfig, logger, additionalParams);
121121
//reqConfig.headers = { ...reqConfig.headers, ...oauthHeaders };

packages/core/src/subsystems/AgentManager/AgentLogger.class.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Agent } from './Agent.class';
22

3-
import { encode } from 'gpt-tokenizer';
3+
//import { encode } from 'gpt-tokenizer';
44
import { AgentCallLog } from '@sre/types/AgentLogger.types';
55
import { debounce, delay, getDayFormattedDate, uid } from '@sre/utils';
66
import { Logger } from '@sre/helpers/Log.helper';
@@ -93,10 +93,14 @@ class LogTransaction {
9393
if (sourceCptName) sourceId += `@${sourceCptName}@${curStepOrder}`;
9494
if (componentCptName) componentId += `@${componentCptName}@${nextStepOrder}`;
9595

96-
const inputTokensObj = encode(typeof firstData.input == 'string' ? firstData.input : JSON.stringify(firstData.input) || '');
97-
const outputTokensObj = encode(typeof firstData.output == 'string' ? firstData.output : JSON.stringify(firstData.output) || '');
98-
const inputTokens = inputTokensObj.length || undefined;
99-
const outputTokens = outputTokensObj.length || undefined;
96+
//const inputTokensObj = encode(typeof firstData.input == 'string' ? firstData.input : JSON.stringify(firstData.input) || '');
97+
//const outputTokensObj = encode(typeof firstData.output == 'string' ? firstData.output : JSON.stringify(firstData.output) || '');
98+
//const inputTokens = inputTokensObj.length || undefined;
99+
//const outputTokens = outputTokensObj.length || undefined;
100+
101+
//token length calculation uses high CPU and does not bring much value ==> disabled
102+
const inputTokens = undefined;
103+
const outputTokens = undefined;
100104

101105
const tags = firstData.tags || '';
102106
let raw_error =

0 commit comments

Comments
 (0)