From c0dde055cd87c5b0261a5f13af6e24328315d363 Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Mon, 18 May 2026 11:02:26 +0800 Subject: [PATCH] =?UTF-8?q?AI=E8=AF=B7=E5=81=87=E5=AF=B9=E6=8E=A5OA?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B7=B3=E8=BD=AC=E5=BE=85=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/services/hr_leave_sqlserver.py | 6 +++ .../tests/test_hr_leave_sqlserver_support.py | 13 ++++++ frontend/src/views/ChatView.vue | 43 ++++++++++++++----- 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 backend/tests/test_hr_leave_sqlserver_support.py diff --git a/backend/app/services/hr_leave_sqlserver.py b/backend/app/services/hr_leave_sqlserver.py index 1f006475..611fb81e 100644 --- a/backend/app/services/hr_leave_sqlserver.py +++ b/backend/app/services/hr_leave_sqlserver.py @@ -40,6 +40,10 @@ class HRLeaveSQLServerService: "明细", "查询", ) + _STRONG_BALANCE_PATTERNS = ( + r"(?:假期|年假|育儿假|休假).{0,6}(?:还剩|还有|剩余|可休|已休|未休|多少)", + r"(?:还剩|还有|剩余|可休|已休|未休|多少).{0,6}(?:假期|年假|育儿假|休假)", + ) @staticmethod def supports(query: str) -> bool: @@ -50,6 +54,8 @@ class HRLeaveSQLServerService: return False if any(keyword in text for keyword in HRLeaveSQLServerService._PROCESS_KEYWORDS): return False + if any(re.search(pattern, text) for pattern in HRLeaveSQLServerService._STRONG_BALANCE_PATTERNS): + return True if not any(keyword in text for keyword in HRLeaveSQLServerService._SELF_KEYWORDS): return False if any(keyword in text for keyword in HRLeaveSQLServerService._BALANCE_KEYWORDS): diff --git a/backend/tests/test_hr_leave_sqlserver_support.py b/backend/tests/test_hr_leave_sqlserver_support.py new file mode 100644 index 00000000..14907889 --- /dev/null +++ b/backend/tests/test_hr_leave_sqlserver_support.py @@ -0,0 +1,13 @@ +from app.services.hr_leave_sqlserver import HRLeaveSQLServerService + + +def test_supports_strong_leave_balance_intent_without_self_pronoun(): + assert HRLeaveSQLServerService.supports("假期还有多少") + assert HRLeaveSQLServerService.supports("还有多少假期") + assert HRLeaveSQLServerService.supports("年假还有多少天") + assert HRLeaveSQLServerService.supports("还有多少年假") + + +def test_supports_rejects_leave_process_questions(): + assert not HRLeaveSQLServerService.supports("假期怎么申请") + assert not HRLeaveSQLServerService.supports("年假制度是什么") diff --git a/frontend/src/views/ChatView.vue b/frontend/src/views/ChatView.vue index 02ee1142..bf872e4d 100644 --- a/frontend/src/views/ChatView.vue +++ b/frontend/src/views/ChatView.vue @@ -434,15 +434,17 @@ const input = ref(''); const currentAgent = ref(null); const showGeneralFeedbackDialog = ref(false); -const OA_LOGIN_URL = 'http://192.168.100.221:8888/login/Login.jsp?logintype=1'; -const OA_VERIFY_LOGIN_URL = 'http://192.168.100.221:8888/login/VerifyLogin.jsp'; +const OA_BASE_URL = 'http://oa.well-trust.com:8888'; +const OA_LOGIN_URL = `${OA_BASE_URL}/login/Login.jsp?logintype=1`; +const OA_VERIFY_LOGIN_URL = `${OA_BASE_URL}/login/VerifyLogin.jsp`; const OA_LEAVE_APPLY_PATH = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid='; +const OA_REQUEST_VIEW_PATH = '/workflow/request/ViewRequest.jsp?requestid='; const OA_AUTO_LOGIN_USERNAME = '26040006'; const OA_AUTO_LOGIN_PASSWORD = '26040006'; const OA_AUTO_LOGIN_TARGET = 'hxops-oa-leave-request'; -const openOALeaveRequestDirectly = () => { - const popup = window.open(OA_LOGIN_URL, OA_AUTO_LOGIN_TARGET); +const openOAAutoLoginPage = (gopage: string, target = OA_AUTO_LOGIN_TARGET) => { + const popup = window.open(OA_LOGIN_URL, target); if (!popup) { showMessageDialog('warning', '浏览器拦截了 OA 页面,请允许弹出窗口后重试。'); return; @@ -451,13 +453,13 @@ const openOALeaveRequestDirectly = () => { const form = document.createElement('form'); form.action = OA_VERIFY_LOGIN_URL; form.method = 'POST'; - form.target = OA_AUTO_LOGIN_TARGET; + form.target = target; form.style.display = 'none'; const fields = { loginid: OA_AUTO_LOGIN_USERNAME, userpassword: OA_AUTO_LOGIN_PASSWORD, - gopage: OA_LEAVE_APPLY_PATH, + gopage, logintype: '1', }; @@ -476,6 +478,19 @@ const openOALeaveRequestDirectly = () => { }, 0); }; +const openOALeaveRequestDirectly = () => { + openOAAutoLoginPage(OA_LEAVE_APPLY_PATH); +}; + +const openOARequestDirectly = (requestId: string) => { + const normalizedRequestId = String(requestId || '').trim(); + if (!normalizedRequestId || normalizedRequestId === '-') { + showMessageDialog('warning', '当前未获取到 OA 单据编号,暂时无法打开单据详情。'); + return; + } + openOAAutoLoginPage(`${OA_REQUEST_VIEW_PATH}${encodeURIComponent(normalizedRequestId)}`, `hxops-oa-request-${normalizedRequestId}`); +}; + const activeFeedbackMessageIndex = ref(null); const browserPanelOpen = ref(false); const browserDraftUrl = ref(''); @@ -516,8 +531,6 @@ const getLeaveTypeLabel = (val: string) => { return t ? t.label : val; }; -const LEAVE_RESULT_QUERY_URL = 'http://192.168.100.221:8888/'; - interface LeaveRequestFormData { applicantName: string; employeeId: string; @@ -1159,7 +1172,7 @@ const confirmLeaveSubmission = async (msg: any) => { const resultMsg = { role: 'assistant' as const, type: 'leave-result' as const, - content: `请假单已提交到 OA,具体单据请到 ${LEAVE_RESULT_QUERY_URL} 查询。`, + content: '请假单已推送到 OA,具体单据请 【 登录OA系统查看提交】', payload: { formId: payload.formId, success: true, @@ -1763,7 +1776,17 @@ const showChatRating = ref(false); : 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-100'" >
{{ getLeaveResultPayload(msg)!.success ? 'OA 提交结果' : 'OA 提交失败' }}
-
{{ msg.content }}
+
+ 请假单已推送到 OA,具体单据请 + + 【 登录OA系统查看提交】 + +
+
{{ msg.content }}
单据编号:{{ getLeaveResultPayload(msg)!.referenceNo }}
提交时间:{{ getLeaveResultPayload(msg)!.submittedAt }}