MCPcopy Create free account
hub / github.com/HisMax/RedInk / get_text_chat_client

Function get_text_chat_client

backend/utils/text_client.py:254–277  ·  view source on GitHub ↗

获取 Text Chat 客户端实例(根据 type 返回对应客户端) Args: provider_config: 服务商配置字典 - type: 'google_gemini' 或 'openai_compatible' - api_key: API密钥 - base_url: API基础URL(可选) - endpoint_type: 自定义端点路径(可选) Returns: GenAIClient 或 TextChatClient

(provider_config: dict)

Source from the content-addressed store, hash-verified

252
253
254def get_text_chat_client(provider_config: dict):
255 """
256 获取 Text Chat 客户端实例(根据 type 返回对应客户端)
257
258 Args:
259 provider_config: 服务商配置字典
260 - type: 'google_gemini''openai_compatible'
261 - api_key: API密钥
262 - base_url: API基础URL(可选)
263 - endpoint_type: 自定义端点路径(可选)
264
265 Returns:
266 GenAIClient 或 TextChatClient
267 """
268 provider_type = provider_config.get('type', 'openai_compatible')
269 api_key = provider_config.get('api_key')
270 base_url = provider_config.get('base_url')
271 endpoint_type = provider_config.get('endpoint_type')
272
273 if provider_type == 'google_gemini':
274 from .genai_client import GenAIClient
275 return GenAIClient(api_key=api_key, base_url=base_url)
276 else:
277 return TextChatClient(api_key=api_key, base_url=base_url, endpoint_type=endpoint_type)

Callers 2

_get_clientMethod · 0.90
_get_clientMethod · 0.90

Calls 3

GenAIClientClass · 0.85
TextChatClientClass · 0.85
getMethod · 0.80

Tested by

no test coverage detected