SessionToFile exports a session to an HTML file. If filename is empty, a default name based on the title and timestamp is used. Returns the absolute path of the created file.
(sess *session.Session, agentDescription, filename string)
| 81 | // If filename is empty, a default name based on the title and timestamp is used. |
| 82 | // Returns the absolute path of the created file. |
| 83 | func SessionToFile(sess *session.Session, agentDescription, filename string) (string, error) { |
| 84 | if sess == nil { |
| 85 | return "", errors.New("no session to export") |
| 86 | } |
| 87 | data := sessionToData(sess) |
| 88 | data.AgentDescription = agentDescription |
| 89 | return ToFile(data, filename) |
| 90 | } |
| 91 | |
| 92 | func sessionToData(sess *session.Session) SessionData { |
| 93 | messages := sess.GetAllMessages() |
no test coverage detected