Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mu

One app for AI chat, news and video
One app for mail, chat, news and video

# Overview

Expand All @@ -14,6 +14,7 @@ Starting with:

- [x] API - Basic API
- [x] App - Installable PWA
- [x] Mail - Internal mail server
- [x] Chat - LLM based chat UI
- [x] News - Latest news headlines
- [x] Video - Video search interface
Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var Template = `
<div id="account">&nbsp;</div>
<div id="nav">
<a href="/home"><img src="home.png" style="margin-bottom: 1px">Home</a>
<a href="/mail"><img src="mail.png">Mail</a>
<a href="/chat"><img src="chat.png">Chat</a>
<a href="/news"><img src="news.png">News</a>
<a href="/video"><img src="video.png">Video</a>
Expand Down
3 changes: 2 additions & 1 deletion app/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
</div>
<div id="main">
<div id="title">Mu</div>
<div id="desc">An app for AI chat, news and video</div>
<div id="desc">One app for mail, chat, news and video</div>
<a href="/home" class="block"><b>Home</b></a>
<a href="/mail" class="block"><b>Mail</b></a>
<a href="/chat" class="block"><b>Chat</b></a>
<a href="/news" class="block"><b>News</b></a>
<a href="/video" class="block"><b>Video</b></a>
Expand Down
203 changes: 203 additions & 0 deletions app/html/mu.css
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,196 @@ td {
display: block;
margin-bottom: 10px;
}
/* Mail Styling - DM-inspired flat design */
#mail {
max-width: 100%;
margin: 0 auto;
}
#mail h1 {
font-size: 1.5em;
margin: 0 0 20px 0;
font-weight: normal;
}
.mail-compose-btn {
display: inline-block;
background: #1a73e8;
color: white;
padding: 10px 20px;
border-radius: 4px;
text-decoration: none;
font-weight: 500;
font-size: 14px;
margin-bottom: 20px;
border: none;
cursor: pointer;
}
.mail-compose-btn:hover {
background: #1557b0;
}
.mail-search {
width: 100%;
max-width: 700px;
padding: 10px 14px;
border: 1px solid #ddd;
border-radius: 4px;
margin-bottom: 20px;
font-size: 14px;
box-sizing: border-box;
}
.mail-list {
max-width: 700px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background: white;
overflow: hidden;
}
.mail-item {
border-bottom: 1px solid #f0f0f0;
padding: 14px 16px;
display: flex;
align-items: center;
gap: 12px;
background: white;
}
.mail-item:last-child {
border-bottom: none;
}
.mail-item.unread {
background: #f8f9fa;
border-left: 3px solid #1a73e8;
padding-left: 13px;
}
.mail-item-content {
flex: 1;
min-width: 0;
cursor: pointer;
}
.mail-item-header {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 3px;
gap: 10px;
}
.mail-item-from {
font-size: 14px;
color: #202124;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 80px;
flex-shrink: 1;
}
.mail-item-time {
font-size: 12px;
color: #5f6368;
white-space: nowrap;
flex-shrink: 0;
}
.mail-item-subject {
font-size: 13px;
color: #202124;
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mail-item-preview {
font-size: 13px;
color: #5f6368;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.mail-item-delete {
flex-shrink: 0;
background: none;
border: none;
cursor: pointer;
padding: 6px;
color: #5f6368;
font-size: 18px;
line-height: 1;
opacity: 0.6;
}
.mail-item-delete:hover {
opacity: 1;
color: #d93025;
}
.mail-empty {
text-align: center;
padding: 40px 20px;
color: #5f6368;
font-size: 14px;
}
/* Compose Form */
.mail-compose {
max-width: 700px;
background: white;
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 20px;
}
.mail-compose h1 {
font-size: 1.3em;
margin-bottom: 20px;
}
.mail-compose-original {
background: #f8f9fa;
border-left: 3px solid #e0e0e0;
padding: 12px;
margin-bottom: 16px;
font-size: 13px;
color: #5f6368;
}
.mail-compose-original-label {
font-weight: 500;
color: #202124;
margin-bottom: 6px;
}
.mail-compose input[type="text"],
.mail-compose textarea {
width: 100%;
padding: 10px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
font-family: inherit;
margin-bottom: 12px;
box-sizing: border-box;
}
.mail-compose textarea {
min-height: 150px;
resize: vertical;
}
.mail-compose button {
background: #1a73e8;
color: white;
padding: 8px 20px;
border-radius: 4px;
border: none;
font-size: 14px;
font-weight: 500;
cursor: pointer;
}
.mail-compose button:hover {
background: #1557b0;
}
.mail-compose-back {
display: inline-block;
margin-left: 12px;
color: #1a73e8;
text-decoration: none;
font-size: 14px;
}
.mail-compose-back:hover {
text-decoration: underline;
}
@media only screen and (max-width: 600px) {
.mail-compose-back:hover {
text-decoration: underline;
}
@media only screen and (max-width: 600px) {
#topics {
text-align: center;
Expand All @@ -369,6 +559,9 @@ td {
background: white;
width: calc(100vw - 40px);
}
#nav img {
margin-right: 0;
}
#container {
height: calc(100vh - 175px);
overflow-y: scroll;
Expand All @@ -391,6 +584,16 @@ td {
min-width: calc(100vw - 85px);
max-width: calc(100vw - 85px);
}
.mail-list, .mail-compose, .mail-search {
max-width: 100%;
}
.mail-item {
flex-direction: column;
align-items: flex-start;
}
.mail-item-header {
width: 100%;
}
#home {
display: block;
flex-direction: column;
Expand Down
8 changes: 8 additions & 0 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,11 @@ func ValidateToken(tk string) error {
}
return nil
}

// AccountExists checks if an account with the given ID exists
func AccountExists(id string) bool {
mutex.Lock()
defer mutex.Unlock()
_, exists := accounts[id]
return exists
}
8 changes: 8 additions & 0 deletions chat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ func Handler(w http.ResponseWriter, r *http.Request) {

q := fmt.Sprintf("%v", form["prompt"])

// Search index for RAG context
// NOTE: We explicitly pass nil here to search all indexed content,
// but mail is intentionally NOT indexed for privacy/security reasons.
// If mail indexing is ever added, this must be updated to filter it out.
res, err := data.Search(q, 10, nil)
if err != nil {
http.Error(w, err.Error(), 500)
Expand All @@ -225,6 +229,10 @@ func Handler(w http.ResponseWriter, r *http.Request) {
var rag []string

for _, val := range res {
// Security: Skip any mail content if it somehow got indexed
if val.Metadata["type"] == "mail" {
continue
}
if len(val.Content) > 512 {
val.Content = val.Content[:512]
}
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ require (
github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b
github.com/google/uuid v1.6.0
github.com/mmcdole/gofeed v1.3.0
github.com/mrz1836/go-sanitize v1.5.3
github.com/philippgille/chromem-go v0.7.0
github.com/piquette/finance-go v1.1.0
golang.org/x/crypto v0.43.0
golang.org/x/net v0.45.0
google.golang.org/api v0.243.0
)

Expand All @@ -28,19 +32,15 @@ require (
github.com/mmcdole/goxpp v1.1.1-0.20240225020742-a0c311522b23 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mrz1836/go-sanitize v1.5.3 // indirect
github.com/philippgille/chromem-go v0.7.0 // indirect
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel v1.36.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect
go.opentelemetry.io/otel/trace v1.36.0 // indirect
golang.org/x/crypto v0.40.0 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sys v0.34.0 // indirect
golang.org/x/text v0.27.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/text v0.30.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250715232539-7130f93afb79 // indirect
google.golang.org/grpc v1.73.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
Expand Down
12 changes: 10 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9Nz
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
Expand All @@ -76,21 +75,30 @@ go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKr
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/net v0.45.0 h1:RLBg5JKixCy82FtLJpeNlVM0nrSqpCRYzVU1n8kj0tM=
golang.org/x/net v0.45.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/api v0.243.0 h1:sw+ESIJ4BVnlJcWu9S+p2Z6Qq1PjG77T8IJ1xtp4jZQ=
google.golang.org/api v0.243.0/go.mod h1:GE4QtYfaybx1KmeHMdBnNnyLzBZCVihGBXAmJu/uUr8=
Expand Down
Loading