Skip to content

Commit 84f4588

Browse files
committed
Fix type errors and update tests for tokenCache implementation
1 parent 949b4c2 commit 84f4588

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

packages/agent/src/core/toolAgent/toolAgentCore.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ export const toolAgent = async (
6464
createCacheControlMessageFromSystemPrompt(systemPrompt),
6565
...addCacheControlToMessages(messages),
6666
]
67-
: [{ role: 'system', content: systemPrompt }, ...messages];
67+
: [
68+
{
69+
role: 'system',
70+
content: systemPrompt,
71+
} as CoreMessage,
72+
...messages,
73+
];
6874

6975
const generateTextProps = {
7076
model: config.model,

packages/cli/src/commands/$default.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
8888
undefined,
8989
argv.tokenUsage ? LogLevel.info : LogLevel.debug,
9090
);
91-
// Use command line option if provided, otherwise use config value
92-
tokenTracker.tokenCache =
93-
argv.tokenCache !== undefined ? argv.tokenCache : userConfig.tokenCache;
9491

9592
try {
9693
// Get configuration for model provider and name
9794
const userConfig = getConfig();
95+
// Use command line option if provided, otherwise use config value
96+
tokenTracker.tokenCache =
97+
argv.tokenCache !== undefined ? argv.tokenCache : userConfig.tokenCache;
98+
9899
const userModelProvider = argv.modelProvider || userConfig.modelProvider;
99100
const userModelName = argv.modelName || userConfig.modelName;
100101

packages/cli/tests/settings/config.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('Config', () => {
4646
ollamaBaseUrl: 'http://localhost:11434/api',
4747
profile: false,
4848
customPrompt: '',
49+
tokenCache: true,
4950
});
5051
expect(fs.existsSync).toHaveBeenCalledWith(mockConfigFile);
5152
});
@@ -80,6 +81,7 @@ describe('Config', () => {
8081
ollamaBaseUrl: 'http://localhost:11434/api',
8182
profile: false,
8283
customPrompt: '',
84+
tokenCache: true,
8385
});
8486
});
8587
});

0 commit comments

Comments
 (0)