===== 会话管理 ===== InitializeSession 初始化会话
(sessionID, userID string)
| 183 | |
| 184 | // InitializeSession 初始化会话 |
| 185 | func (w *Workflow) InitializeSession(sessionID, userID string) (string, string) { |
| 186 | if sessionID == "" { |
| 187 | if w.SessionID != "" { |
| 188 | sessionID = w.SessionID |
| 189 | } else { |
| 190 | sessionID = uuid.New().String() |
| 191 | w.SessionID = sessionID |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | if userID == "" { |
| 196 | userID = w.UserID |
| 197 | } |
| 198 | |
| 199 | return sessionID, userID |
| 200 | } |
| 201 | |
| 202 | // GetSession 获取会话 |
| 203 | func (w *Workflow) GetSession(sessionID string) (*WorkflowSession, error) { |