update: xai增加max_tokens,max_words等参数
This commit is contained in:
@@ -120,9 +120,13 @@ class Anthropic(Platform):
|
|||||||
|
|
||||||
|
|
||||||
class XAi(Platform):
|
class XAi(Platform):
|
||||||
|
max_tokens: int
|
||||||
|
temperature: int
|
||||||
|
|
||||||
def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None:
|
def __init__(self, config: BaseProxyConfig, http: ClientSession) -> None:
|
||||||
super().__init__(config, http)
|
super().__init__(config, http)
|
||||||
|
self.temperature = self.config['temperature']
|
||||||
|
self.max_tokens = self.config['max_tokens']
|
||||||
|
|
||||||
async def create_chat_completion(self, plugin: AbsExtraConfigPlugin, evt: MessageEvent) -> ChatCompletion:
|
async def create_chat_completion(self, plugin: AbsExtraConfigPlugin, evt: MessageEvent) -> ChatCompletion:
|
||||||
full_context = []
|
full_context = []
|
||||||
@@ -139,6 +143,9 @@ class XAi(Platform):
|
|||||||
"stream": False
|
"stream": False
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if 'max_tokens' in self.config and self.max_tokens:
|
||||||
|
data["max_tokens"] = self.max_tokens
|
||||||
|
|
||||||
if 'temperature' in self.config and self.temperature:
|
if 'temperature' in self.config and self.temperature:
|
||||||
request_body["temperature"] = self.temperature
|
request_body["temperature"] = self.temperature
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user