From 58b8794ddc92c6616d0847f09f49425aaff3002e Mon Sep 17 00:00:00 2001 From: crazywoola <427733928@qq.com> Date: Tue, 10 Sep 2024 15:06:05 +0800 Subject: [PATCH 1/2] chore: remove useless code --- api/core/model_runtime/model_providers/azure_openai/llm/llm.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py index c0c782e42b4a9b..bd089466d7b326 100644 --- a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py +++ b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py @@ -416,8 +416,6 @@ def _handle_chat_generate_stream_response( ) ) - index += 0 - # calculate num tokens prompt_tokens = self._num_tokens_from_messages(credentials, prompt_messages, tools) From 559c9588ebd6d75e1a1fc75b3ec68af92c42e26b Mon Sep 17 00:00:00 2001 From: crazywoola <427733928@qq.com> Date: Wed, 11 Sep 2024 17:48:38 +0800 Subject: [PATCH 2/2] fix: index should be += 1 --- api/core/model_runtime/model_providers/azure_openai/llm/llm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py index bd089466d7b326..d0bae89d2c03ec 100644 --- a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py +++ b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py @@ -416,6 +416,8 @@ def _handle_chat_generate_stream_response( ) ) + index += 1 + # calculate num tokens prompt_tokens = self._num_tokens_from_messages(credentials, prompt_messages, tools)