diff --git a/README.md b/README.md index 8115334..181e11c 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Test access: https://caloi.top/v1/chat/completions is equivalent to https://api. - [Usage](#Usage) - [Service Deployment](#Service-Deployment) - [Service Usage](#Service-Usage) +- [Configuration](#Configuration) # Features - [x] Supports forwarding of all OpenAI interfaces @@ -140,7 +141,7 @@ Replace with http://{ip}:{port}/v1/chat/completions ``` -# Configuration Options +# Configuration **`openai-forward run` Parameter Configuration Options** diff --git a/README_ZH.md b/README_ZH.md index 312f033..1fada28 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -65,6 +65,7 @@ api的服务器上,通过该服务转发OpenAI的请求。即搭建反向代 - [Usage](#Usage) - [安装部署](#安装部署) - [服务调用](#服务调用) +- [配置选项](#配置选项) # Features diff --git a/openai_forward/_base.py b/openai_forward/_base.py index 5b287a5..9592378 100644 --- a/openai_forward/_base.py +++ b/openai_forward/_base.py @@ -4,7 +4,7 @@ import httpx from starlette.background import BackgroundTask import os -from .content.chat import log_chat_completions, ChatSaver +from .content.chat import parse_chat_completions, ChatSaver class OpenaiBase: @@ -37,7 +37,7 @@ def validate_request_host(self, ip): @classmethod def log_chat_completions(cls, bytes_: bytes): - target_info = log_chat_completions(bytes_) + target_info = parse_chat_completions(bytes_) cls.chatsaver.add_chat({target_info['role']: target_info['content']}) @classmethod diff --git a/openai_forward/content/chat.py b/openai_forward/content/chat.py index 7b14baf..2095f61 100644 --- a/openai_forward/content/chat.py +++ b/openai_forward/content/chat.py @@ -20,7 +20,7 @@ def _parse_iter_line_content(line: str): return "" -def log_chat_completions(bytes_: bytes): +def parse_chat_completions(bytes_: bytes): txt_lines = decoder.decode(bytes_.decode('utf-8')) line0 = txt_lines[0] target_info = dict()