mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-22 07:03:58 +08:00
Release v2.1.1: Token Handling Improvement and DeepSeek Support
- Completely reworked token handling mechanism - Removed custom token calculation logic - Direct max_tokens passing to LLM APIs - Added support for DeepSeek provider - Integrated deepseek-chat and deepseek-reasoner models Thanks to @estiens for reporting token handling issues and providing valuable feedback (https://github.com/smkrv/ha-text-ai/issues/1).
This commit is contained in:
@@ -39,11 +39,14 @@ from .const import (
|
||||
CONF_CONTEXT_MESSAGES,
|
||||
API_PROVIDER_OPENAI,
|
||||
API_PROVIDER_ANTHROPIC,
|
||||
API_PROVIDER_DEEPSEEK,
|
||||
DEFAULT_MODEL,
|
||||
DEFAULT_DEEPSEEK_MODEL,
|
||||
DEFAULT_TEMPERATURE,
|
||||
DEFAULT_MAX_TOKENS,
|
||||
DEFAULT_OPENAI_ENDPOINT,
|
||||
DEFAULT_ANTHROPIC_ENDPOINT,
|
||||
DEFAULT_DEEPSEEK_ENDPOINT,
|
||||
DEFAULT_REQUEST_INTERVAL,
|
||||
DEFAULT_CONTEXT_MESSAGES,
|
||||
API_TIMEOUT,
|
||||
@@ -235,6 +238,8 @@ async def async_check_api(session, endpoint: str, headers: dict, provider: str)
|
||||
try:
|
||||
if provider == API_PROVIDER_ANTHROPIC:
|
||||
check_url = f"{endpoint}/v1/models"
|
||||
elif provider == API_PROVIDER_DEEPSEEK:
|
||||
check_url = f"{endpoint}/models" # DeepSeek
|
||||
else: # OpenAI
|
||||
check_url = f"{endpoint}/models"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user