mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
refactor: remove unnecessary as-any casts for cachableFields (already in ModelInfo type)
This commit is contained in:
parent
64055fcdae
commit
d8bf3fccf2
2 changed files with 6 additions and 9 deletions
|
|
@ -1416,10 +1416,10 @@ describe("AwsBedrockHandler", () => {
|
|||
|
||||
const modelConfig = customArnHandler.getModel()
|
||||
expect(modelConfig.info.supportsPromptCache).toBe(true)
|
||||
expect((modelConfig.info as any).cachableFields).toBeDefined()
|
||||
expect((modelConfig.info as any).cachableFields).toContain("system")
|
||||
expect((modelConfig.info as any).cachableFields).toContain("messages")
|
||||
expect((modelConfig.info as any).cachableFields).toContain("tools")
|
||||
expect(modelConfig.info.cachableFields).toBeDefined()
|
||||
expect(modelConfig.info.cachableFields).toContain("system")
|
||||
expect(modelConfig.info.cachableFields).toContain("messages")
|
||||
expect(modelConfig.info.cachableFields).toContain("tools")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1176,10 +1176,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
|
|||
|
||||
private supportsAwsPromptCache(modelConfig: { id: BedrockModelId | string; info: ModelInfo }): boolean | undefined {
|
||||
// Check if the model supports prompt cache
|
||||
// The cachableFields property is not part of the ModelInfo type in schemas
|
||||
// but it's used in the bedrockModels object in shared/api.ts
|
||||
const hasCachableFields =
|
||||
(modelConfig?.info as any)?.cachableFields && (modelConfig?.info as any)?.cachableFields?.length > 0
|
||||
const hasCachableFields = modelConfig?.info?.cachableFields && modelConfig.info.cachableFields.length > 0
|
||||
|
||||
if (modelConfig?.info?.supportsPromptCache && hasCachableFields) {
|
||||
return true
|
||||
|
|
@ -1194,7 +1191,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
|
|||
// simply ignores cache points without erroring.
|
||||
if (this.options.awsCustomArn && this.options.awsUsePromptCache !== false) {
|
||||
if (!hasCachableFields) {
|
||||
;(modelConfig.info as any).cachableFields = ["system", "messages", "tools"]
|
||||
modelConfig.info.cachableFields = ["system", "messages", "tools"]
|
||||
}
|
||||
modelConfig.info.supportsPromptCache = true
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue