feat: search sessions, attach files, read aloud, jump to latest

Reach the first-party mobile client's everyday features:

- sessions: a search button opens a field; typing asks the server with
  its search parameter (350 ms settle) and clearing restores the list
- composer: attach photos or files (up to five, 10 MB each) as data
  URLs with the prompt; attachments show as removable chips and are
  named under the sent message
- turn menu: read the answer aloud with the system voice, or stop it
- chat: a "latest" button appears after scrolling up and returns to the
  end of the conversation
- reset a live search when a connection ends

Bump version to 0.2.0 (build 14).
This commit is contained in:
blumia committed 2026-11-17 21:52:06 +08:00
1 parent 4c6fcf4cbe
commit 72119b73e8
11 files changed
+445 -56

No files matched your search

+36
View File
@@ -2,6 +2,7 @@ package appui
import (
"strings"
"time"
"github.com/egoist/asuka/colors"
"github.com/egoist/asuka/fonts"
@@ -13,6 +14,17 @@ import (
func (c *controller) sessionsScreen() ui.Node {
nav := ui.UseNavigator()
c.nav = nav
// Live search: typing settles for a moment, then the server is asked.
signal.Effect(func() {
q := c.sessionQuery.Get()
if !c.searchOpen.Get() {
return
}
t := time.AfterFunc(350*time.Millisecond, func() {
ui.Post(func() { c.searchSessions(q) })
})
signal.OnCleanup(func() { t.Stop() })
})
return ui.SafeArea(ui.Style{Grow: 1}, ui.Column(ui.Style{Grow: 1},
ui.Row(ui.Style{Padding: ui.Symmetric(8, 16), Gap: 4, Align: ui.AlignCenter},
ui.Column(ui.Style{Grow: 1, Gap: 2},
@@ -22,8 +34,32 @@ func (c *controller) sessionsScreen() ui.Node {
return ui.Text(c.errorMsg, ui.Style{Font: fonts.Footnote, Color: colors.Red, Lines: 2})
}),
),
ui.Button(ui.ButtonProps{Icon: ui.IconSearch, Label: ui.Val("搜索会话"),
OnPress: func() {
open := !c.searchOpen.Peek()
c.searchOpen.Set(open)
if !open {
c.sessionQuery.Set("")
c.searchSessions("")
}
}}),
c.instancesButton(),
),
ui.Show(c.searchOpen, func() ui.Node {
return ui.Row(ui.Style{Padding: ui.Symmetric(0, 12), Gap: 6, Align: ui.AlignCenter},
ui.TextField(ui.TextFieldProps{
Value: c.sessionQuery,
Placeholder: ui.Val("输入关键词搜索"),
ReturnKey: ui.ReturnSearch,
OnSubmit: func() { c.searchSessions(c.sessionQuery.Peek()) },
Style: ui.Style{Grow: 1},
}),
ui.Button(ui.ButtonProps{Title: ui.Val("清除"), OnPress: func() {
c.sessionQuery.Set("")
c.searchSessions("")
}}),
)
}),
ui.Show(signal.Func(func() bool { return len(c.sessions.Get()) == 0 }),
func() ui.Node {
return ui.Column(ui.Style{Padding: ui.All(20), Gap: 8},