diff --git a/README.md b/README.md index 27f877f..c3fc193 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ 2. 增加港股、美股支持。 3. 完善Dockerfile、GitHub Actions 支持docker一键部署使用。 4. 支持x86_64 和 ARM64架构镜像 +5. 支持流式输出,支持前端传入Key(仅作为本地用户使用,日志等内容不会输出) 感谢@Cassianvale ## docker一键部署 ``` diff --git a/stock_analyzer.py b/stock_analyzer.py index 43d92e2..bcf9375 100644 --- a/stock_analyzer.py +++ b/stock_analyzer.py @@ -7,6 +7,7 @@ from typing import Dict, List, Optional, Tuple, Generator from dotenv import load_dotenv import json from logger import get_logger +from utils.api_utils import APIUtils # 获取日志器 logger = get_logger() @@ -259,12 +260,8 @@ class StockAnalyzer: logger.error(error_msg) return error_msg if not stream else (yield json.dumps({"error": error_msg})) - # 标准化API URL 使用Cherry Studio相同逻辑处理 - if self.API_URL.endswith('/'): - api_url = f"{self.API_URL}chat/completions" - else: - api_url = f"{self.API_URL}/v1/chat/completions" - + # 标准化API URL + api_url = APIUtils.format_api_url(self.API_URL) logger.debug(f"标准化后的API URL: {api_url}") diff --git a/templates/index.html b/templates/index.html index 979f6bc..eeeeb61 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,28 +7,202 @@ + + + {% if announcement %} +
+
+
+
+ + + +
+
+

+

+
+ +
+
+
+ + + {% endif %} +

股票分析系统

- - - {% if announcement %} + +
-
-
-
- - - +
+
+ +
+

当前时间

+

-
-

- {{ announcement }} -

+ + +
+

A股市场

+

+

+
+ + +
+

港股市场

+

+

+
+ + +
+

美股市场

+

+

- {% endif %} + +
@@ -54,7 +228,9 @@ + value="{{ default_api_url }}" + oninput="updateFormattedUrl(this.value)"> +

@@ -115,10 +291,10 @@