From 45d1c89e452b4aa55cbec1e9f3b8c5d543bfd046 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Mon, 31 Jul 2023 14:28:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20text=E7=9A=84=E4=BD=BF=E7=94=A8=E9=87=8F?= =?UTF-8?q?=E6=9C=AA=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/openai/manager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/openai/manager.py b/pkg/openai/manager.py index c607f22..46893b6 100644 --- a/pkg/openai/manager.py +++ b/pkg/openai/manager.py @@ -52,6 +52,13 @@ class OpenAIInteract: # 请求接口 for resp in request: + + if resp['usage']['total_tokens'] > 0: + self.audit_mgr.report_text_model_usage( + model, + resp['usage']['total_tokens'] + ) + yield resp def request_image(self, prompt) -> dict: