fix: make support IM delivery recoverable
Deploy olons-server production / deploy (push) Successful in 3m38s

This commit is contained in:
Your Name
2026-10-19 17:23:34 +08:00
parent c39ec78e89
commit db18514e6d
11 changed files with 898 additions and 60 deletions
+8 -2
View File
@@ -70,6 +70,12 @@ type Session struct {
Agent Agent `json:"agent"`
}
const (
publicIMAPIPath = "/v1/im"
publicIMWebSocketPath = "/v0/channels"
publicIMFilePath = "/v0/file"
)
func New(repository Repository, im IM, authConfig config.AuthConfig) *Service {
return &Service{repository: repository, im: im, aead: credentialAEAD(authConfig)}
}
@@ -158,8 +164,8 @@ func (s *Service) OpenSession(ctx context.Context, tenantID, memberID, serviceID
return nil, ErrRelationDenied
}
return &Session{
TenantCode: cfg.TenantCode, APIBaseURL: cfg.HTTPAPIURL, WebSocketURL: cfg.WebSocketURL,
FileURL: cfg.FileURL, APIKey: cfg.APIKey, Token: imSession.Token, ExpiresAt: imSession.ExpiresAt,
TenantCode: cfg.TenantCode, APIBaseURL: publicIMAPIPath, WebSocketURL: publicIMWebSocketPath,
FileURL: publicIMFilePath, APIKey: cfg.APIKey, Token: imSession.Token, ExpiresAt: imSession.ExpiresAt,
CurrentUserID: imSession.UserID, Topic: conversation.Topic, Relationship: "friend",
Agent: Agent{ID: agent.ID, IMUserID: agent.IMUserID, Name: agent.Name, AvatarURL: agent.AvatarURL,
OnlineStatus: customerServiceStatus(agent.OnlineStatus)},