feat: 优化客服会话及延迟消息逻辑
This commit is contained in:
@@ -6,11 +6,6 @@ var (
|
||||
PlatformXHS = newPlatform(gconv.PtrString("xiaohongshu"), "小红书")
|
||||
PlatformDY = newPlatform(gconv.PtrString("douyin"), "抖音")
|
||||
PlatformKS = newPlatform(gconv.PtrString("kuaishou"), "快手")
|
||||
platformMap = map[Platform]platform{
|
||||
gconv.PtrString("xiaohongshu"): PlatformXHS,
|
||||
gconv.PtrString("douyin"): PlatformDY,
|
||||
gconv.PtrString("kuaishou"): PlatformKS,
|
||||
}
|
||||
)
|
||||
|
||||
type Platform *string
|
||||
@@ -32,8 +27,13 @@ func newPlatform(code Platform, desc string) platform {
|
||||
}
|
||||
|
||||
func GetDescByCode(code Platform) string {
|
||||
if p, ok := platformMap[code]; ok {
|
||||
return p.Desc()
|
||||
switch *code {
|
||||
case *PlatformXHS.Code():
|
||||
return PlatformXHS.Desc()
|
||||
case *PlatformDY.Code():
|
||||
return PlatformDY.Desc()
|
||||
case *PlatformKS.Code():
|
||||
return PlatformKS.Desc()
|
||||
}
|
||||
return "未知平台"
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package account
|
||||
|
||||
import "github.com/gogf/gf/v2/util/gconv"
|
||||
|
||||
var (
|
||||
VectorStatusPending = newVectorStatus(gconv.PtrInt8(1), "pending")
|
||||
VectorStatusProcessing = newVectorStatus(gconv.PtrInt8(2), "processing")
|
||||
VectorStatusCompleted = newVectorStatus(gconv.PtrInt8(3), "completed")
|
||||
VectorStatusFailed = newVectorStatus(gconv.PtrInt8(4), "failed")
|
||||
)
|
||||
|
||||
type VectorStatus *int8
|
||||
|
||||
type vectorStatus struct {
|
||||
code VectorStatus
|
||||
desc string
|
||||
}
|
||||
|
||||
func (s vectorStatus) Code() VectorStatus {
|
||||
return s.code
|
||||
}
|
||||
func (s vectorStatus) Desc() string {
|
||||
return s.desc
|
||||
}
|
||||
|
||||
func newVectorStatus(code VectorStatus, desc string) vectorStatus {
|
||||
return vectorStatus{code: code, desc: desc}
|
||||
}
|
||||
@@ -2,7 +2,11 @@ package public
|
||||
|
||||
const GmqMsgPluginsName = "gmq_msg"
|
||||
|
||||
const AccountDialogKeyUserId = "account:dialog:%s"
|
||||
const (
|
||||
AccountMsgKey = "account:%s:%s:%s"
|
||||
AccountDialogHistoryKey = "account:dialog:history:%s"
|
||||
AccountGreetingOptionsKey = "account:greeting:options:%s"
|
||||
)
|
||||
|
||||
const (
|
||||
AccountFollowupTopic = "account:followup:stream" // 请求 Stream 键名(与发消息的key一致)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package public
|
||||
|
||||
const KnowledgeLockEsKey = "rag:knowledge:lock:knowledgeIdEs-%v"
|
||||
const KnowledgeLockSqlKey = "rag:knowledge:lock:knowledgeIdSql-%v"
|
||||
const KnowledgeContentHashEsKey = "rag:knowledge:knowledgeId:contentHashEs-%v"
|
||||
const KnowledgeContentHashSqlKey = "rag:knowledge:knowledgeId:contentHashSql-%v"
|
||||
|
||||
const KnowledgeDocumentChunkTopic = "knowledge:document:chunk:stream" // 请求 Stream 键名(与发消息的key一致)
|
||||
|
||||
const (
|
||||
KnowledgeDocumentVectorStatusTopic = "knowledge:document:vector:status:stream"
|
||||
KnowledgeDocumentVectorStatusConsumer = "knowledge-document-vector-status-consumer"
|
||||
KnowledgeDocumentVectorStatusBatchSize = 1
|
||||
KnowledgeDocumentVectorStatusAutoAck = false
|
||||
)
|
||||
18
consts/public/session_tool.go
Normal file
18
consts/public/session_tool.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package public
|
||||
|
||||
// 欢迎语
|
||||
const (
|
||||
GreetingBegin = "您好,很高兴为您服务!请问有什么可以帮您?"
|
||||
GreetingBetween = "💗回复数字就好~"
|
||||
GreetingEnd = "🌟也可直接点击下方咨询专业老师~"
|
||||
)
|
||||
|
||||
// 追问
|
||||
const (
|
||||
SceneOpeningRemark = "宝子,刚才给您发的信息您有看到吗?有任何问题都能直接问我,加微信也能更方便沟通~"
|
||||
SceneDialog = "看您暂时没回复,是不是还有什么疑问?加微信我详细给您说明~"
|
||||
SceneCardSend = "宝子,加上没~要及时加哦,不然卡片容易失效哒✨"
|
||||
)
|
||||
|
||||
// 对话超时时间
|
||||
const DialogTimeout = 10
|
||||
@@ -6,12 +6,6 @@ var (
|
||||
SceneTypeOpeningRemark = newSceneType(gconv.PtrInt8(1), "开场白无回应")
|
||||
SceneTypeDialog = newSceneType(gconv.PtrInt8(2), "对话中途无回应")
|
||||
SceneTypeCardSend = newSceneType(gconv.PtrInt8(3), "卡片发送后无回应")
|
||||
|
||||
sceneTypeMap = map[SceneType]sceneType{
|
||||
gconv.PtrInt8(1): SceneTypeOpeningRemark,
|
||||
gconv.PtrInt8(2): SceneTypeDialog,
|
||||
gconv.PtrInt8(3): SceneTypeCardSend,
|
||||
}
|
||||
)
|
||||
|
||||
type SceneType *int8
|
||||
@@ -33,8 +27,13 @@ func newSceneType(code SceneType, desc string) sceneType {
|
||||
}
|
||||
|
||||
func GetDescByCode(code SceneType) string {
|
||||
if p, ok := sceneTypeMap[code]; ok {
|
||||
return p.Desc()
|
||||
switch *code {
|
||||
case *SceneTypeOpeningRemark.Code():
|
||||
return SceneTypeOpeningRemark.Desc()
|
||||
case *SceneTypeDialog.Code():
|
||||
return SceneTypeDialog.Desc()
|
||||
case *SceneTypeCardSend.Code():
|
||||
return SceneTypeCardSend.Desc()
|
||||
}
|
||||
return "未知场景类型"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user