diff --git a/pkg/openai/manager.py b/pkg/openai/manager.py index ebd94b67..c607f220 100644 --- a/pkg/openai/manager.py +++ b/pkg/openai/manager.py @@ -54,40 +54,6 @@ class OpenAIInteract: for resp in request: yield resp - # 请求OpenAI Completion - # def request_completion(self, prompts): - # """请求补全接口回复 - # """ - - # config = pkg.utils.context.get_config() - - # # 根据模型选择使用的接口 - # ai: ModelRequest = create_openai_model_request( - # config.completion_api_params['model'], - # 'user', - # config.openai_config["http_proxy"] if "http_proxy" in config.openai_config else None - # ) - # ai.request( - # prompts, - # **config.completion_api_params - # ) - # response = ai.get_response() - - # logging.debug("OpenAI response: %s", response) - - # # 记录使用量 - # current_round_token = 0 - # if 'model' in config.completion_api_params: - # self.audit_mgr.report_text_model_usage(config.completion_api_params['model'], - # ai.get_total_tokens()) - # current_round_token = ai.get_total_tokens() - # elif 'engine' in config.completion_api_params: - # self.audit_mgr.report_text_model_usage(config.completion_api_params['engine'], - # response['usage']['total_tokens']) - # current_round_token = response['usage']['total_tokens'] - - # return ai.get_message(), current_round_token - def request_image(self, prompt) -> dict: """请求图片接口回复