-
Notifications
You must be signed in to change notification settings - Fork 9
/
report.go
49 lines (46 loc) · 2.95 KB
/
report.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package aiagent
import (
"strings"
lang "github.com/abadojack/whatlanggo"
)
// buildReport
func (m *EMail) buildReport() string {
var s strings.Builder
s.WriteString("####################################################" + _linefeed)
s.WriteString("####################################################" + _linefeed)
s.WriteString("# -= AI MESSAGE ANALYSIS REPORT =- #" + _linefeed)
s.WriteString("####################################################" + _linefeed)
s.WriteString("####################################################" + _linefeed)
s.WriteString("# INBOUND MESSAGE [debug] : " + _dlinefeed + m.Raw + _dlinefeed)
s.WriteString("# OFFLINE PREFLIGHT ANALYSIS " + _linefeed)
s.WriteString("## Language : " + lang.Langs[m.Local.Lang.Lang] + _linefeed)
s.WriteString("## Confidence : " + ctoa(m) + _linefeed)
s.WriteString("## SpellFixes : " + m.SpellSummary() + _linefeed)
s.WriteString("## Customer Email : " + m.Local.Addr.String() + _linefeed)
s.WriteString("## Customer Email RFC5322 : " + validExit(m.Local.AddrRFC) + _linefeed)
s.WriteString("## Customer Email Domain MX : " + validExit(m.Local.AddrMX) + _linefeed)
s.WriteString("## Customer DB entry : " + validExit(m.Local.AddrDB) + _linefeed)
s.WriteString("## Anonymized EMailAddresses : " + isArray(m.Privacy.EMails) + _linefeed)
s.WriteString("## Anonymized URLs : " + isArray(m.Privacy.URLs) + _linefeed)
s.WriteString("## Anonymized PhoneNumbers : " + isArray(m.Privacy.Phones) + _linefeed)
s.WriteString("## Raw / Filtered Characters : " + itoa(m.OpenAI.Raw.Chars) + _sep2 + itoa(m.OpenAI.Msg.Chars) + _linefeed)
s.WriteString("## Raw / Filtered Words : " + itoa(m.OpenAI.Raw.Words) + _sep2 + itoa(m.OpenAI.Msg.Words) + _linefeed)
s.WriteString("## Raw / Filtered GPT3 Token : " + itoa(m.OpenAI.Raw.Token) + _sep2 + itoa(m.OpenAI.Msg.Token) + _linefeed)
s.WriteString("## Raw / Filtered GPT3 Price : " + price(m.OpenAI.Raw.Cost) + _sep2 + price(m.OpenAI.Msg.Cost) + _linefeed)
if m.OpenAI.Processed {
s.WriteString("## Time needed for section : " + m.Local.ProcessedTime.String() + _dlinefeed)
s.WriteString("# ONLINE ML MODULES RESOLVER " + _linefeed)
s.WriteString("## OpenAI query state : " + valid(m.OpenAI.State) + _linefeed)
s.WriteString("## OpenAI says cancel : " + yesno(m.OpenAI.IsCancel) + _linefeed)
s.WriteString("## OpenAI analysis [debug] : " + _dlinefeed + m.OpenAI.Answer + _dlinefeed)
if len(m.OpenAI.Response) > 10 {
s.WriteString("## OpenAI Auto Response email: " + _dlinefeed + m.OpenAI.Response + _dlinefeed)
}
s.WriteString("## Time needed for section : " + m.OpenAI.ProcessedTime.String() + _linefeed)
} else {
s.WriteString("## No OpenAI query performed, inbound data quality failed." + _linefeed)
s.WriteString("## Time needed for section : " + m.Local.ProcessedTime.String() + _linefeed)
}
s.WriteString(_dlinefeed)
return s.String()
}