MeUtils 2025.6.13.20.54.5__py3-none-any.whl → 2025.6.18.16.30.56__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,9 +34,9 @@ async def get_bearer_token(
34
34
 
35
35
  token = auth.credentials
36
36
  if token.startswith('redis:'): # redis里按序轮询
37
- if "feishu.cn" in token:
37
+ if "feishu.cn" in token: # redis:https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=Y7HVfo
38
38
  feishu_url = token.removeprefix("redis:")
39
- token = await get_next_token(feishu_url, ttl=24 * 3600) # todo: 摆脱 feishu
39
+ token = await get_next_token(feishu_url, ttl=24 * 3600)
40
40
 
41
41
  # logger.debug(token)
42
42
 
@@ -44,10 +44,15 @@ async def get_bearer_token(
44
44
  tokens = token.removeprefix("redis:").split(',') # todo: 初始化redis
45
45
  token = np.random.choice(tokens)
46
46
 
47
+ elif token.startswith("http") and "feishu.cn" in token: # feishu 取所有 keys 主要针对 channel
48
+ feishu_url = token
49
+ tokens = await get_series(feishu_url)
50
+ token = '\n'.join(tokens) # 多渠道
51
+
47
52
  elif ',' in token: # 内存里随机轮询
48
53
  token = np.random.choice(token.split(','))
49
54
 
50
- elif token in {"none", "null"}:
55
+ elif token in {"None", "none", "null"}:
51
56
  token = None
52
57
 
53
58
  return token
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # @Project : AI. @by PyCharm
4
- # @File : openai_siliconflow
5
- # @Time : 2024/6/26 10:42
6
- # @Author : betterme
7
- # @WeChat : meutils
8
- # @Software : PyCharm
9
- # @Description :
10
- import os
11
-
12
- from meutils.pipe import *
13
- from openai import OpenAI
14
- from openai import OpenAI, APIStatusError
15
-
16
-
17
- client = OpenAI(
18
- # base_url="https://free.chatfire.cn/v1",
19
- api_key="9a867a14-26d1-4950-89ae-dd989dec10b5-b137b199a507d6f5",
20
- base_url="https://all.chatfire.cc/kindo/v1"
21
-
22
- )
23
-
24
- try:
25
- client.chat.completions.create(
26
- messages=[
27
- {"role": "user", "content": "你是谁"}
28
- ],
29
- model="azure/gpt-4o-mini",
30
- )
31
- except Exception as e:
32
- print(e)