mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
chore: removed chinese comments to pass ruff checks and updated migration nos
This commit is contained in:
parent
c99469bfdf
commit
ba5bb91a7b
5 changed files with 41 additions and 58 deletions
|
|
@ -83,6 +83,7 @@ class LiteLLMProvider(str, Enum):
|
|||
Enum for LLM providers supported by LiteLLM.
|
||||
LiteLLM 支持的 LLM 提供商枚举。
|
||||
"""
|
||||
|
||||
OPENAI = "OPENAI"
|
||||
ANTHROPIC = "ANTHROPIC"
|
||||
GROQ = "GROQ"
|
||||
|
|
@ -106,11 +107,11 @@ class LiteLLMProvider(str, Enum):
|
|||
ALEPH_ALPHA = "ALEPH_ALPHA"
|
||||
PETALS = "PETALS"
|
||||
COMETAPI = "COMETAPI"
|
||||
# Chinese LLM Providers (OpenAI-compatible) / 国产 LLM 提供商(OpenAI 兼容)
|
||||
DEEPSEEK = "DEEPSEEK" # DeepSeek
|
||||
ALIBABA_QWEN = "ALIBABA_QWEN" # 阿里通义千问
|
||||
MOONSHOT = "MOONSHOT" # 月之暗面 (Kimi)
|
||||
ZHIPU = "ZHIPU" # 智谱 AI (GLM)
|
||||
# Chinese LLM Providers (OpenAI-compatible)
|
||||
DEEPSEEK = "DEEPSEEK"
|
||||
ALIBABA_QWEN = "ALIBABA_QWEN"
|
||||
MOONSHOT = "MOONSHOT"
|
||||
ZHIPU = "ZHIPU"
|
||||
CUSTOM = "CUSTOM"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ async def get_user_llm_instance(
|
|||
"AZURE_OPENAI": "azure",
|
||||
"OPENROUTER": "openrouter",
|
||||
"COMETAPI": "cometapi",
|
||||
# Chinese LLM providers (OpenAI-compatible) / 国产 LLM(OpenAI 兼容)
|
||||
"DEEPSEEK": "openai", # DeepSeek uses OpenAI-compatible API
|
||||
"ALIBABA_QWEN": "openai", # Qwen uses OpenAI-compatible API
|
||||
"MOONSHOT": "openai", # Moonshot (Kimi) uses OpenAI-compatible API
|
||||
"ZHIPU": "openai", # Zhipu (GLM) uses OpenAI-compatible API
|
||||
# Chinese LLM providers (OpenAI-compatible)
|
||||
"DEEPSEEK": "openai", # DeepSeek uses OpenAI-compatible API
|
||||
"ALIBABA_QWEN": "openai", # Qwen uses OpenAI-compatible API
|
||||
"MOONSHOT": "openai", # Moonshot (Kimi) uses OpenAI-compatible API
|
||||
"ZHIPU": "openai", # Zhipu (GLM) uses OpenAI-compatible API
|
||||
# Add more mappings as needed
|
||||
}
|
||||
provider_prefix = provider_map.get(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import contextlib
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
|
@ -73,16 +74,14 @@ class TaskLoggingService:
|
|||
Returns:
|
||||
Log: The updated log entry
|
||||
"""
|
||||
# Ensure session is in a valid state / 确保 session 处于有效状态
|
||||
# Ensure session is in a valid state
|
||||
if not self.session.is_active:
|
||||
await self.session.rollback()
|
||||
|
||||
# Refresh log_entry to avoid expired state / 刷新 log_entry 避免过期状态
|
||||
try:
|
||||
|
||||
# Refresh log_entry to avoid expired state
|
||||
with contextlib.suppress(Exception):
|
||||
await self.session.refresh(log_entry)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# Update the existing log entry
|
||||
log_entry.status = LogStatus.SUCCESS
|
||||
log_entry.message = message
|
||||
|
|
@ -124,17 +123,14 @@ class TaskLoggingService:
|
|||
Returns:
|
||||
Log: The updated log entry
|
||||
"""
|
||||
# Ensure session is in a valid state / 确保 session 处于有效状态
|
||||
# Ensure session is in a valid state
|
||||
if not self.session.is_active:
|
||||
await self.session.rollback()
|
||||
|
||||
# Refresh log_entry to avoid expired state / 刷新 log_entry 避免过期状态
|
||||
try:
|
||||
|
||||
# Refresh log_entry to avoid expired state
|
||||
with contextlib.suppress(Exception):
|
||||
await self.session.refresh(log_entry)
|
||||
except Exception:
|
||||
# If refresh fails, the object might be detached / 如果刷新失败,对象可能已分离
|
||||
pass
|
||||
|
||||
|
||||
# Update the existing log entry
|
||||
log_entry.status = LogStatus.FAILED
|
||||
log_entry.level = LogLevel.ERROR
|
||||
|
|
@ -182,16 +178,14 @@ class TaskLoggingService:
|
|||
Returns:
|
||||
Log: The updated log entry
|
||||
"""
|
||||
# Ensure session is in a valid state / 确保 session 处于有效状态
|
||||
# Ensure session is in a valid state
|
||||
if not self.session.is_active:
|
||||
await self.session.rollback()
|
||||
|
||||
# Refresh log_entry to avoid expired state / 刷新 log_entry 避免过期状态
|
||||
try:
|
||||
|
||||
# Refresh log_entry to avoid expired state
|
||||
with contextlib.suppress(Exception):
|
||||
await self.session.refresh(log_entry)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
log_entry.message = progress_message
|
||||
|
||||
if progress_metadata:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue