mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 02:09:03 +08:00
Co-authored-by: icarus <eurfelux@gmail.com> Co-authored-by: eeee0717 <chentao020717@outlook.com>
26 lines
845 B
TypeScript
26 lines
845 B
TypeScript
import { BailianStrategy } from './BailianStrategy'
|
|
import { DefaultStrategy } from './DefaultStrategy'
|
|
import { JinaStrategy } from './JinaStrategy'
|
|
import { RerankStrategy } from './RerankStrategy'
|
|
import { TEIStrategy } from './TeiStrategy'
|
|
import { isTEIProvider, RERANKER_PROVIDERS } from './types'
|
|
import { VoyageAIStrategy } from './VoyageStrategy'
|
|
|
|
export class StrategyFactory {
|
|
static createStrategy(provider?: string): RerankStrategy {
|
|
switch (provider) {
|
|
case RERANKER_PROVIDERS.VOYAGEAI:
|
|
return new VoyageAIStrategy()
|
|
case RERANKER_PROVIDERS.BAILIAN:
|
|
return new BailianStrategy()
|
|
case RERANKER_PROVIDERS.JINA:
|
|
return new JinaStrategy()
|
|
default:
|
|
if (isTEIProvider(provider)) {
|
|
return new TEIStrategy()
|
|
}
|
|
return new DefaultStrategy()
|
|
}
|
|
}
|
|
}
|