Merge branch 'main' of ssh://git.qubit.ltd:10022/lyman/FA3-Datafetch

This commit is contained in:
xucheng 2026-02-01 18:46:37 +08:00
commit fb89ae2d51
3 changed files with 28 additions and 7 deletions

View File

@ -58,11 +58,15 @@ async def chat_with_ai(request: ChatRequest, background_tasks: BackgroundTasks =
tools.append(types.Tool(google_search=types.GoogleSearch()))
final_system_prompt += "\n\n[SYSTEM INSTRUCTION] You have access to Google Search. You MUST use it to verify any data or find the latest information before answering. Do not rely solely on your internal knowledge."
config = types.GenerateContentConfig(
tools=tools if tools else None,
temperature=0.1,
system_instruction=final_system_prompt
)
# Build config - only set system_instruction if it has content
config_params = {
"tools": tools if tools else None,
"temperature": 0.1
}
if final_system_prompt and final_system_prompt.strip():
config_params["system_instruction"] = final_system_prompt
config = types.GenerateContentConfig(**config_params)
start_time = time.time()

View File

@ -22,6 +22,19 @@ def get_genai_client() -> genai.Client:
api_key = os.getenv('GEMINI_API_KEY')
if not api_key:
raise ValueError("GEMINI_API_KEY environment variable is not set")
# Configure httpx proxy globally by monkey-patching
import httpx
proxy_url = os.getenv('https_proxy') or os.getenv('HTTPS_PROXY')
if proxy_url:
# Monkey-patch httpx to use proxy with SSL verification disabled
original_init = httpx.Client.__init__
def patched_init(self, **kwargs):
kwargs.setdefault('proxy', proxy_url)
kwargs.setdefault('verify', False)
return original_init(self, **kwargs)
httpx.Client.__init__ = patched_init
_client = genai.Client(api_key=api_key)
return _client

View File

@ -6,13 +6,17 @@ module.exports = {
args: "-m uvicorn backend.app.main:app --host 0.0.0.0 --port 8000",
cwd: "./",
env: {
PYTHONPATH: "./backend"
PYTHONPATH: "./backend",
// HTTP_PROXY: "http://192.168.3.91:7893",
// HTTPS_PROXY: "http://192.168.3.91:7893",
// http_proxy: "http://192.168.3.91:7893",
// https_proxy: "http://192.168.3.91:7893"
}
},
{
name: "datafetch-frontend",
script: "npm",
args: "run dev", // 生产环境建议改为 "start" 并先运行 npm run build
args: "run dev",
cwd: "./frontend",
env: {
NODE_ENV: "development"