增加图QA问答

This commit is contained in:
2025-07-14 15:36:15 +08:00
parent 46552a536f
commit 32136be5db
6 changed files with 283 additions and 215 deletions
+22 -1
View File
@@ -1,3 +1,24 @@
import os
#os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = 'http://10.1.6.34:4318'
#os.environ["OTEL_SERVICE_NAME"] = 'web/worker'
#os.environ["OTEL_TRACE_SAMPLING_RATIO"] = '1'
import phoenix as px
from phoenix.otel import register
from openinference.instrumentation.langchain import LangChainInstrumentor
# configure the Phoenix tracer
tracer_provider = register(
endpoint="http://10.1.6.34:6006/v1/traces",
project_name="streamlt-app", # Default is 'default'
auto_instrument=True, # See 'Trace all calls made to a library' below
verbose=True
)
#tracer = tracer_provider.get_tracer(__name__)
LangChainInstrumentor(tracer_provider=tracer_provider).instrument(skip_dep_check=False)
import streamlit as st
import json
import os
@@ -230,7 +251,7 @@ def load_session_state():
# 测试指标查询
@st.cache_data(ttl=60) # 缓存结果1分钟
@st.cache_data(ttl=5) # 缓存结果5分钟
def generate_indicator_code(query: str) -> str:
"""生成指标代码"""
if not query.strip():