add: 添加ollama调用AI chat逻辑
This commit is contained in:
@@ -138,15 +138,15 @@ class AiBotPlugin(Plugin):
|
|||||||
if use_platform == 'local_ai':
|
if use_platform == 'local_ai':
|
||||||
type = self.config['platforms']['local_ai']['type']
|
type = self.config['platforms']['local_ai']['type']
|
||||||
if type == 'ollama':
|
if type == 'ollama':
|
||||||
return Ollama(self.config)
|
return Ollama(self.config, self.http)
|
||||||
elif type == 'lmstudio':
|
elif type == 'lmstudio':
|
||||||
return LmStudio(self.config)
|
return LmStudio(self.config, self.http)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"not found platform type: {type}")
|
raise ValueError(f"not found platform type: {type}")
|
||||||
if use_platform == 'openai':
|
if use_platform == 'openai':
|
||||||
return OpenAi(self.config)
|
return OpenAi(self.config, self.http)
|
||||||
if use_platform == 'anthropic':
|
if use_platform == 'anthropic':
|
||||||
return Anthropic(self.config)
|
return Anthropic(self.config, self.http)
|
||||||
raise ValueError(f"unknown backend type {use_platform}")
|
raise ValueError(f"unknown backend type {use_platform}")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -45,4 +45,10 @@ class Ollama(Platform):
|
|||||||
|
|
||||||
|
|
||||||
class LmStudio(Platform):
|
class LmStudio(Platform):
|
||||||
|
|
||||||
|
def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None:
|
||||||
|
super().__init__(config, http)
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def create_chat_completion(self, evt: MessageEvent) -> ChatCompletion:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user