feat: low-latency debounce, context logs, and stable draw/upload config
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
This commit is contained in:
@@ -26,7 +26,7 @@ async def auto_draw_preview(
|
||||
"""
|
||||
try:
|
||||
logger.info("[作图] 开始 customer=%s image=%s", customer_id, image_url)
|
||||
from services.service_gemini import GeminiExtractV2Service # type: ignore
|
||||
from services.service_gemini_stable import GeminiExtractStableService # type: ignore
|
||||
from services.service_tuhui_upload import upload_to_tuhui # type: ignore
|
||||
except Exception as e:
|
||||
logger.error("[作图] 依赖加载失败: %s", e)
|
||||
@@ -56,7 +56,7 @@ async def auto_draw_preview(
|
||||
logger.info("[作图] 原图下载完成 size=%s", len(resp.content))
|
||||
|
||||
logger.info("[作图] Gemini 生成中")
|
||||
service = GeminiExtractV2Service()
|
||||
service = GeminiExtractStableService()
|
||||
ok_extract, msg_extract, _ = await service.extract_pattern(
|
||||
input_path=input_path,
|
||||
output_path=output_path,
|
||||
|
||||
@@ -14,6 +14,7 @@ from .config import (
|
||||
AUTO_DRAW_ENABLED,
|
||||
AUTO_QUOTE_WAIT_SECONDS,
|
||||
DECISION_TIMEOUT_SECONDS,
|
||||
IMAGE_MESSAGE_DEBOUNCE_SECONDS,
|
||||
MAX_CONCURRENT_TURNS,
|
||||
MESSAGE_DEBOUNCE_SECONDS,
|
||||
QINGJIAN_WS_URI,
|
||||
@@ -133,7 +134,7 @@ class QingjianClient:
|
||||
|
||||
def _debounce_seconds(self, msg: str) -> float:
|
||||
if extract_image_urls(msg):
|
||||
return 2.5
|
||||
return float(IMAGE_MESSAGE_DEBOUNCE_SECONDS)
|
||||
return float(MESSAGE_DEBOUNCE_SECONDS)
|
||||
|
||||
async def send_message(self, message: dict) -> None:
|
||||
@@ -271,7 +272,7 @@ class QingjianClient:
|
||||
def _fallback_reply(self, action: str) -> str:
|
||||
if action == "transfer":
|
||||
return "我先给你转人工处理。"
|
||||
return "收到,我先处理一下。"
|
||||
return "我先看看"
|
||||
|
||||
def _is_outbound_echo(self, data: dict, msg: str) -> bool:
|
||||
"""
|
||||
@@ -338,6 +339,20 @@ class QingjianClient:
|
||||
"last_reply": self.last_reply_key.get(key, ""),
|
||||
"recent_dialogue": recent_dialogue[-12:],
|
||||
}
|
||||
try:
|
||||
rd = context.get("recent_dialogue", []) or []
|
||||
rd_preview = " | ".join(
|
||||
[f"{str(x.get('role',''))}:{str(x.get('text',''))[:32]}" for x in rd[-8:] if isinstance(x, dict)]
|
||||
)
|
||||
self.logger.info(
|
||||
"[AI上下文] customer=%s msg=%s pending_images=%s recent=%s",
|
||||
context["customer_id"],
|
||||
str(merged_msg or "")[:120],
|
||||
context["pending_images"],
|
||||
rd_preview,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
activity_event(self.logger, "agent_process_start", trace_id=trace_id, customer_id=context["customer_id"], acc_id=context["acc_id"], intent=context["intent"])
|
||||
route, decision, state = await self.orchestrator.decide(context)
|
||||
|
||||
@@ -12,9 +12,10 @@ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "").strip()
|
||||
OPENAI_BASE_URL = os.getenv("OPENAI_BASE_URL", "https://ark.cn-beijing.volces.com/api/v3").strip()
|
||||
OPENAI_MODEL_NAME = os.getenv("OPENAI_MODEL_NAME", "doubao-seed-2-0-pro-260215").strip()
|
||||
|
||||
MESSAGE_DEBOUNCE_SECONDS = int(os.getenv("MESSAGE_DEBOUNCE_SECONDS", "6"))
|
||||
MESSAGE_DEBOUNCE_SECONDS = float(os.getenv("MESSAGE_DEBOUNCE_SECONDS", "0.8"))
|
||||
IMAGE_MESSAGE_DEBOUNCE_SECONDS = float(os.getenv("IMAGE_MESSAGE_DEBOUNCE_SECONDS", "1.2"))
|
||||
AUTO_QUOTE_WAIT_SECONDS = int(os.getenv("AUTO_QUOTE_WAIT_SECONDS", "18"))
|
||||
AGENT_MAX_ITERS = int(os.getenv("AGENT_MAX_ITERS", "3"))
|
||||
AGENT_MAX_ITERS = int(os.getenv("AGENT_MAX_ITERS", "1"))
|
||||
FAST_ROUTE_ENABLED = os.getenv("FAST_ROUTE_ENABLED", "1").strip() in {"1", "true", "True", "yes", "on"}
|
||||
SHORT_REPLY_MAX_CHARS = int(os.getenv("SHORT_REPLY_MAX_CHARS", "18"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user