feat(background-agent): add ConcurrencyManager for model-based limits
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
parent
8394926fe1
commit
580d4bb0a1
@ -10,20 +10,14 @@ export class ConcurrencyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConcurrencyLimit(model: string): number {
|
getConcurrencyLimit(model: string): number {
|
||||||
const modelLimit = this.config?.modelConcurrency?.[model]
|
if (this.config?.modelConcurrency?.[model]) {
|
||||||
if (modelLimit !== undefined) {
|
return this.config.modelConcurrency[model]
|
||||||
return modelLimit === 0 ? Infinity : modelLimit
|
|
||||||
}
|
}
|
||||||
const provider = model.split('/')[0]
|
const provider = model.split('/')[0]
|
||||||
const providerLimit = this.config?.providerConcurrency?.[provider]
|
if (this.config?.providerConcurrency?.[provider]) {
|
||||||
if (providerLimit !== undefined) {
|
return this.config.providerConcurrency[provider]
|
||||||
return providerLimit === 0 ? Infinity : providerLimit
|
|
||||||
}
|
}
|
||||||
const defaultLimit = this.config?.defaultConcurrency
|
return this.config?.defaultConcurrency ?? Infinity
|
||||||
if (defaultLimit !== undefined) {
|
|
||||||
return defaultLimit === 0 ? Infinity : defaultLimit
|
|
||||||
}
|
|
||||||
return 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async acquire(model: string): Promise<void> {
|
async acquire(model: string): Promise<void> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user