|
|
@@ -442,20 +442,26 @@ export default {
|
|
442
|
442
|
})
|
|
443
|
443
|
},
|
|
444
|
444
|
renderChatMarkdown,
|
|
445
|
|
- /** 若依问诊会话主键:listAiConsultSessions 使用 realSessionId */
|
|
|
445
|
+ /** 若依问诊主键:listAiConsultMessages / sendAiConsultMessage 路径参数(id,非 realSessionId) */
|
|
446
|
446
|
resolveSessionId(session) {
|
|
447
|
447
|
if (!session) {
|
|
448
|
448
|
return null
|
|
449
|
449
|
}
|
|
450
|
|
- if (session.realSessionId != null && session.realSessionId !== "") {
|
|
451
|
|
- return String(session.realSessionId)
|
|
|
450
|
+ if (typeof session === "string" || typeof session === "number") {
|
|
|
451
|
+ return String(session)
|
|
452
|
452
|
}
|
|
453
|
453
|
if (session.id != null && session.id !== "") {
|
|
454
|
454
|
return String(session.id)
|
|
455
|
455
|
}
|
|
|
456
|
+ if (session.sessionId != null && session.sessionId !== "") {
|
|
|
457
|
+ return String(session.sessionId)
|
|
|
458
|
+ }
|
|
|
459
|
+ if (session.realSessionId != null && session.realSessionId !== "") {
|
|
|
460
|
+ return String(session.realSessionId)
|
|
|
461
|
+ }
|
|
456
|
462
|
return null
|
|
457
|
463
|
},
|
|
458
|
|
- /** 列表 rows[].sessionId 为大模型网关会话 id */
|
|
|
464
|
+ /** 列表行中的大模型网关 sessionId(real_session_id / llmSessionId) */
|
|
459
|
465
|
resolveLlmSessionIdFromRow(session) {
|
|
460
|
466
|
if (!session) {
|
|
461
|
467
|
return null
|
|
|
@@ -464,6 +470,12 @@ export default {
|
|
464
|
470
|
return String(session.llmSessionId)
|
|
465
|
471
|
}
|
|
466
|
472
|
const consultId = this.resolveSessionId(session)
|
|
|
473
|
+ if (session.realSessionId != null && session.realSessionId !== "") {
|
|
|
474
|
+ const rid = String(session.realSessionId)
|
|
|
475
|
+ if (!consultId || rid !== consultId) {
|
|
|
476
|
+ return rid
|
|
|
477
|
+ }
|
|
|
478
|
+ }
|
|
467
|
479
|
if (session.sessionId != null && session.sessionId !== "") {
|
|
468
|
480
|
const sid = String(session.sessionId)
|
|
469
|
481
|
if (!consultId || sid !== consultId) {
|
|
|
@@ -609,15 +621,14 @@ export default {
|
|
609
|
621
|
if (data.disclaimer) {
|
|
610
|
622
|
this.disclaimer = data.disclaimer
|
|
611
|
623
|
}
|
|
612
|
|
- const id = data.realSessionId != null ? data.realSessionId : data.id
|
|
613
|
|
- if (!id) {
|
|
|
624
|
+ if (data.id == null || data.id === "") {
|
|
614
|
625
|
return
|
|
615
|
626
|
}
|
|
616
|
|
- const consultId = String(id)
|
|
|
627
|
+ const consultId = String(data.id)
|
|
617
|
628
|
this.clearLlmSessionId(consultId)
|
|
618
|
629
|
const row = {
|
|
619
|
630
|
id: consultId,
|
|
620
|
|
- realSessionId: consultId,
|
|
|
631
|
+ realSessionId: data.realSessionId || null,
|
|
621
|
632
|
llmSessionId: null,
|
|
622
|
633
|
sessionTitle: data.sessionTitle || DEFAULT_SESSION_TITLE,
|
|
623
|
634
|
lastMessagePreview: data.lastMessagePreview || "",
|
|
|
@@ -788,11 +799,11 @@ export default {
|
|
788
|
799
|
}
|
|
789
|
800
|
})
|
|
790
|
801
|
return (rows || []).map((row) => {
|
|
791
|
|
- const id = this.resolveSessionId(row)
|
|
792
|
|
- if (!id) {
|
|
|
802
|
+ const consultId =
|
|
|
803
|
+ row.id != null && row.id !== "" ? String(row.id) : this.resolveSessionId(row)
|
|
|
804
|
+ if (!consultId) {
|
|
793
|
805
|
return row
|
|
794
|
806
|
}
|
|
795
|
|
- const consultId = String(id)
|
|
796
|
807
|
const llm =
|
|
797
|
808
|
this.resolveLlmSessionIdFromRow(row) ||
|
|
798
|
809
|
prevMap[consultId] ||
|
|
|
@@ -800,8 +811,7 @@ export default {
|
|
800
|
811
|
null
|
|
801
|
812
|
const next = {
|
|
802
|
813
|
...row,
|
|
803
|
|
- id: consultId,
|
|
804
|
|
- realSessionId: row.realSessionId != null ? row.realSessionId : consultId
|
|
|
814
|
+ id: consultId
|
|
805
|
815
|
}
|
|
806
|
816
|
if (llm) {
|
|
807
|
817
|
next.llmSessionId = String(llm)
|