sycommon-python-lib 0.1.56b16__tar.gz → 0.1.56b18__tar.gz
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.
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/PKG-INFO +9 -9
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/pyproject.toml +9 -9
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/get_llm.py +25 -12
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/nacos_service_discovery.py +17 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/merge_headers.py +20 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon_python_lib.egg-info/PKG-INFO +9 -9
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon_python_lib.egg-info/requires.txt +8 -8
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/README.md +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/setup.cfg +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/command/cli.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/Config.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/LLMConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/database/async_database_service.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/database/database_service.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/embedding.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/llm_tokens.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/kafka_log.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/middleware.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/mq.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/timeout.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/sso_user.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/notice/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sentry/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/services.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sse/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sse/sse.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/feign.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/feign_client.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/nacos_client_base.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/nacos_config_manager.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/nacos_service.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/nacos_service_registration.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/env.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon_python_lib.egg-info/SOURCES.txt +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
- {sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sycommon-python-lib
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.56b18
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Requires-Dist: aio-pika>=9.5.8
|
|
8
|
-
Requires-Dist: aiohttp>=3.13.
|
|
8
|
+
Requires-Dist: aiohttp>=3.13.3
|
|
9
9
|
Requires-Dist: aiomysql>=0.3.2
|
|
10
10
|
Requires-Dist: decorator>=5.2.1
|
|
11
|
-
Requires-Dist: fastapi>=0.
|
|
11
|
+
Requires-Dist: fastapi>=0.128.0
|
|
12
12
|
Requires-Dist: kafka-python>=2.3.0
|
|
13
|
-
Requires-Dist: langchain>=1.2.
|
|
14
|
-
Requires-Dist: langchain-core>=1.2.
|
|
15
|
-
Requires-Dist: langchain-openai>=1.1.
|
|
13
|
+
Requires-Dist: langchain>=1.2.3
|
|
14
|
+
Requires-Dist: langchain-core>=1.2.7
|
|
15
|
+
Requires-Dist: langchain-openai>=1.1.7
|
|
16
16
|
Requires-Dist: langfuse>=3.11.2
|
|
17
|
-
Requires-Dist: langgraph>=1.0.
|
|
17
|
+
Requires-Dist: langgraph>=1.0.6
|
|
18
18
|
Requires-Dist: loguru>=0.7.3
|
|
19
19
|
Requires-Dist: mysql-connector-python>=9.5.0
|
|
20
20
|
Requires-Dist: nacos-sdk-python<3.0,>=2.0.9
|
|
21
|
-
Requires-Dist: psutil>=7.1
|
|
21
|
+
Requires-Dist: psutil>=7.2.1
|
|
22
22
|
Requires-Dist: pydantic>=2.12.5
|
|
23
23
|
Requires-Dist: python-dotenv>=1.2.1
|
|
24
24
|
Requires-Dist: pyyaml>=6.0.3
|
|
25
|
-
Requires-Dist: sentry-sdk[fastapi]>=2.
|
|
25
|
+
Requires-Dist: sentry-sdk[fastapi]>=2.49.0
|
|
26
26
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.45
|
|
27
27
|
Requires-Dist: starlette>=0.50.0
|
|
28
28
|
Requires-Dist: uvicorn>=0.40.0
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sycommon-python-lib"
|
|
3
|
-
version = "0.1.56-
|
|
3
|
+
version = "0.1.56-beta18"
|
|
4
4
|
description = "Add your description here"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"aio-pika>=9.5.8",
|
|
9
|
-
"aiohttp>=3.13.
|
|
9
|
+
"aiohttp>=3.13.3",
|
|
10
10
|
"aiomysql>=0.3.2",
|
|
11
11
|
"decorator>=5.2.1",
|
|
12
|
-
"fastapi>=0.
|
|
12
|
+
"fastapi>=0.128.0",
|
|
13
13
|
"kafka-python>=2.3.0",
|
|
14
|
-
"langchain>=1.2.
|
|
15
|
-
"langchain-core>=1.2.
|
|
16
|
-
"langchain-openai>=1.1.
|
|
14
|
+
"langchain>=1.2.3",
|
|
15
|
+
"langchain-core>=1.2.7",
|
|
16
|
+
"langchain-openai>=1.1.7",
|
|
17
17
|
"langfuse>=3.11.2",
|
|
18
|
-
"langgraph>=1.0.
|
|
18
|
+
"langgraph>=1.0.6",
|
|
19
19
|
"loguru>=0.7.3",
|
|
20
20
|
"mysql-connector-python>=9.5.0",
|
|
21
21
|
"nacos-sdk-python>=2.0.9,<3.0",
|
|
22
|
-
"psutil>=7.1
|
|
22
|
+
"psutil>=7.2.1",
|
|
23
23
|
"pydantic>=2.12.5",
|
|
24
24
|
"python-dotenv>=1.2.1",
|
|
25
25
|
"pyyaml>=6.0.3",
|
|
26
|
-
"sentry-sdk[fastapi]>=2.
|
|
26
|
+
"sentry-sdk[fastapi]>=2.49.0",
|
|
27
27
|
"sqlalchemy[asyncio]>=2.0.45",
|
|
28
28
|
"starlette>=0.50.0",
|
|
29
29
|
"uvicorn>=0.40.0",
|
|
@@ -14,6 +14,7 @@ from sycommon.config.LLMConfig import LLMConfig
|
|
|
14
14
|
from sycommon.llm.llm_tokens import TokensCallbackHandler
|
|
15
15
|
from sycommon.logging.kafka_log import SYLogger
|
|
16
16
|
from sycommon.tools.env import get_env_var
|
|
17
|
+
from sycommon.tools.merge_headers import get_header_value
|
|
17
18
|
from langfuse.langchain import CallbackHandler
|
|
18
19
|
|
|
19
20
|
|
|
@@ -77,17 +78,23 @@ class StructuredRunnableWithToken(Runnable):
|
|
|
77
78
|
def invoke(self, input: Any, config: Optional[RunnableConfig] = None, ** kwargs) -> Dict[str, Any]:
|
|
78
79
|
try:
|
|
79
80
|
with self.langfuse.start_as_current_observation(as_type="span", name="invoke") as span:
|
|
80
|
-
|
|
81
|
+
trace_id = SYLogger.get_trace_id()
|
|
82
|
+
userid = get_header_value(
|
|
83
|
+
SYLogger.get_headers(), "x-userid-header")
|
|
84
|
+
syVersion = get_header_value(
|
|
85
|
+
SYLogger.get_headers(), "s-y-version")
|
|
86
|
+
|
|
87
|
+
user_id = userid or syVersion or get_env_var('VERSION')
|
|
88
|
+
with propagate_attributes(session_id=trace_id, user_id=user_id):
|
|
81
89
|
processed_config, token_handler = self._get_callback_config(
|
|
82
90
|
config)
|
|
83
91
|
adapted_input = self._adapt_input(input)
|
|
92
|
+
input = {"messages": adapted_input}
|
|
84
93
|
|
|
85
|
-
span.update_trace(
|
|
86
|
-
input={"messages": adapted_input}
|
|
87
|
-
)
|
|
94
|
+
span.update_trace(input=input)
|
|
88
95
|
|
|
89
96
|
structured_result = self.retry_chain.invoke(
|
|
90
|
-
|
|
97
|
+
input,
|
|
91
98
|
config={**processed_config, **self.metadata},
|
|
92
99
|
**kwargs
|
|
93
100
|
)
|
|
@@ -98,7 +105,6 @@ class StructuredRunnableWithToken(Runnable):
|
|
|
98
105
|
structured_result._token_usage_ = token_usage
|
|
99
106
|
|
|
100
107
|
return structured_result
|
|
101
|
-
|
|
102
108
|
except Exception as e:
|
|
103
109
|
SYLogger.error(f"同步LLM调用失败: {str(e)}", exc_info=True)
|
|
104
110
|
return None
|
|
@@ -107,17 +113,24 @@ class StructuredRunnableWithToken(Runnable):
|
|
|
107
113
|
async def ainvoke(self, input: Any, config: Optional[RunnableConfig] = None, ** kwargs) -> Dict[str, Any]:
|
|
108
114
|
try:
|
|
109
115
|
with self.langfuse.start_as_current_observation(as_type="span", name="ainvoke") as span:
|
|
110
|
-
|
|
116
|
+
trace_id = SYLogger.get_trace_id()
|
|
117
|
+
userid = get_header_value(
|
|
118
|
+
SYLogger.get_headers(), "x-userid-header")
|
|
119
|
+
syVersion = get_header_value(
|
|
120
|
+
SYLogger.get_headers(), "s-y-version")
|
|
121
|
+
|
|
122
|
+
user_id = userid or syVersion or get_env_var('VERSION')
|
|
123
|
+
with propagate_attributes(session_id=trace_id, user_id=user_id):
|
|
111
124
|
processed_config, token_handler = self._get_callback_config(
|
|
112
125
|
config)
|
|
113
126
|
adapted_input = self._adapt_input(input)
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
128
|
+
input = {"messages": adapted_input}
|
|
129
|
+
|
|
130
|
+
span.update_trace(input=input)
|
|
118
131
|
|
|
119
132
|
structured_result = await self.retry_chain.ainvoke(
|
|
120
|
-
|
|
133
|
+
input,
|
|
121
134
|
config={**processed_config, **self.metadata},
|
|
122
135
|
**kwargs
|
|
123
136
|
)
|
|
@@ -128,7 +141,6 @@ class StructuredRunnableWithToken(Runnable):
|
|
|
128
141
|
structured_result._token_usage_ = token_usage
|
|
129
142
|
|
|
130
143
|
return structured_result
|
|
131
|
-
|
|
132
144
|
except Exception as e:
|
|
133
145
|
SYLogger.error(f"异步LLM调用失败: {str(e)}", exc_info=True)
|
|
134
146
|
return None
|
|
@@ -268,6 +280,7 @@ def _init_langfuse() -> Tuple[List[CallbackHandler], Optional[Langfuse]]:
|
|
|
268
280
|
os.environ["LANGFUSE_PUBLIC_KEY"] = target_config.get('publicKey', '')
|
|
269
281
|
os.environ["LANGFUSE_BASE_URL"] = target_config.get('baseUrl', '')
|
|
270
282
|
os.environ["LANGFUSE_TRACING_ENVIRONMENT"] = environment
|
|
283
|
+
os.environ["OTEL_SERVICE_NAME"] = server_name
|
|
271
284
|
|
|
272
285
|
# 创建 Langfuse Handler 和 Client
|
|
273
286
|
langfuse_handler = CallbackHandler(
|
|
@@ -78,6 +78,23 @@ class NacosServiceDiscovery:
|
|
|
78
78
|
SYLogger.info(
|
|
79
79
|
f"nacos:未找到相同版本({version_to_use})的实例,筛选出 {len(no_version_instances)} 个无版本号的实例")
|
|
80
80
|
return no_version_instances
|
|
81
|
+
else:
|
|
82
|
+
no_version_instances = [
|
|
83
|
+
instance for instance in all_instances
|
|
84
|
+
if 'version' not in instance.get('metadata', {})
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
if no_version_instances:
|
|
88
|
+
# 从通用实例中轮询
|
|
89
|
+
with self._round_robin_lock:
|
|
90
|
+
selected_index = self._round_robin_index % len(
|
|
91
|
+
no_version_instances)
|
|
92
|
+
self._round_robin_index = (
|
|
93
|
+
selected_index + 1) % len(no_version_instances)
|
|
94
|
+
|
|
95
|
+
SYLogger.info(
|
|
96
|
+
f"nacos:无版本请求,从 {len(no_version_instances)} 个通用实例中选择")
|
|
97
|
+
return [no_version_instances[selected_index]]
|
|
81
98
|
|
|
82
99
|
SYLogger.info(
|
|
83
100
|
f"nacos:使用轮询方式从 {len(all_instances)} 个实例中选择")
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/merge_headers.py
RENAMED
|
@@ -95,3 +95,23 @@ def merge_headers(
|
|
|
95
95
|
processed_headers[key_lower] = value
|
|
96
96
|
|
|
97
97
|
return processed_headers
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def get_header_value(headers: list, target_key: str, default=None):
|
|
101
|
+
"""
|
|
102
|
+
从列表中查找指定 header 的值
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
headers: header 列表,例如 [('Content-Type', 'application/json'), ...]
|
|
106
|
+
target_key: 要查找的 key
|
|
107
|
+
default: 如果没找到返回的默认值
|
|
108
|
+
"""
|
|
109
|
+
if not headers:
|
|
110
|
+
return default
|
|
111
|
+
|
|
112
|
+
for item in headers:
|
|
113
|
+
# 兼容 list 和 tuple,确保长度为2
|
|
114
|
+
if isinstance(item, (list, tuple)) and len(item) == 2 and item[0] == target_key:
|
|
115
|
+
return item[1]
|
|
116
|
+
|
|
117
|
+
return default
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sycommon-python-lib
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.56b18
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Requires-Dist: aio-pika>=9.5.8
|
|
8
|
-
Requires-Dist: aiohttp>=3.13.
|
|
8
|
+
Requires-Dist: aiohttp>=3.13.3
|
|
9
9
|
Requires-Dist: aiomysql>=0.3.2
|
|
10
10
|
Requires-Dist: decorator>=5.2.1
|
|
11
|
-
Requires-Dist: fastapi>=0.
|
|
11
|
+
Requires-Dist: fastapi>=0.128.0
|
|
12
12
|
Requires-Dist: kafka-python>=2.3.0
|
|
13
|
-
Requires-Dist: langchain>=1.2.
|
|
14
|
-
Requires-Dist: langchain-core>=1.2.
|
|
15
|
-
Requires-Dist: langchain-openai>=1.1.
|
|
13
|
+
Requires-Dist: langchain>=1.2.3
|
|
14
|
+
Requires-Dist: langchain-core>=1.2.7
|
|
15
|
+
Requires-Dist: langchain-openai>=1.1.7
|
|
16
16
|
Requires-Dist: langfuse>=3.11.2
|
|
17
|
-
Requires-Dist: langgraph>=1.0.
|
|
17
|
+
Requires-Dist: langgraph>=1.0.6
|
|
18
18
|
Requires-Dist: loguru>=0.7.3
|
|
19
19
|
Requires-Dist: mysql-connector-python>=9.5.0
|
|
20
20
|
Requires-Dist: nacos-sdk-python<3.0,>=2.0.9
|
|
21
|
-
Requires-Dist: psutil>=7.1
|
|
21
|
+
Requires-Dist: psutil>=7.2.1
|
|
22
22
|
Requires-Dist: pydantic>=2.12.5
|
|
23
23
|
Requires-Dist: python-dotenv>=1.2.1
|
|
24
24
|
Requires-Dist: pyyaml>=6.0.3
|
|
25
|
-
Requires-Dist: sentry-sdk[fastapi]>=2.
|
|
25
|
+
Requires-Dist: sentry-sdk[fastapi]>=2.49.0
|
|
26
26
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.45
|
|
27
27
|
Requires-Dist: starlette>=0.50.0
|
|
28
28
|
Requires-Dist: uvicorn>=0.40.0
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
aio-pika>=9.5.8
|
|
2
|
-
aiohttp>=3.13.
|
|
2
|
+
aiohttp>=3.13.3
|
|
3
3
|
aiomysql>=0.3.2
|
|
4
4
|
decorator>=5.2.1
|
|
5
|
-
fastapi>=0.
|
|
5
|
+
fastapi>=0.128.0
|
|
6
6
|
kafka-python>=2.3.0
|
|
7
|
-
langchain>=1.2.
|
|
8
|
-
langchain-core>=1.2.
|
|
9
|
-
langchain-openai>=1.1.
|
|
7
|
+
langchain>=1.2.3
|
|
8
|
+
langchain-core>=1.2.7
|
|
9
|
+
langchain-openai>=1.1.7
|
|
10
10
|
langfuse>=3.11.2
|
|
11
|
-
langgraph>=1.0.
|
|
11
|
+
langgraph>=1.0.6
|
|
12
12
|
loguru>=0.7.3
|
|
13
13
|
mysql-connector-python>=9.5.0
|
|
14
14
|
nacos-sdk-python<3.0,>=2.0.9
|
|
15
|
-
psutil>=7.1
|
|
15
|
+
psutil>=7.2.1
|
|
16
16
|
pydantic>=2.12.5
|
|
17
17
|
python-dotenv>=1.2.1
|
|
18
18
|
pyyaml>=6.0.3
|
|
19
|
-
sentry-sdk[fastapi]>=2.
|
|
19
|
+
sentry-sdk[fastapi]>=2.49.0
|
|
20
20
|
sqlalchemy[asyncio]>=2.0.45
|
|
21
21
|
starlette>=0.50.0
|
|
22
22
|
uvicorn>=0.40.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/Config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/LLMConfig.py
RENAMED
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/MQConfig.py
RENAMED
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/SentryConfig.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/config/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/__init__.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/health_check.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/health/metrics.py
RENAMED
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/__init__.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/embedding.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/llm_logger.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/llm/llm_tokens.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/kafka_log.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/logging/sql_logger.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/__init__.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/context.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/cors.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/docs.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/exception.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/mq.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/timeout.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/middleware/traceid.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/__init__.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/base_http.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/mqmsg_model.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/mqsend_config.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/models/sso_user.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/notice/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sentry/__init__.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sentry/sy_sentry.py
RENAMED
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/sse/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/__init__.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/example.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/example2.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/feign.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/feign_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/synacos/param.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/snowflake.py
RENAMED
|
File without changes
|
{sycommon_python_lib-0.1.56b16 → sycommon_python_lib-0.1.56b18}/src/sycommon/tools/timing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|