频道自动补全:channels 表(DBv2 回填去重) + GET /api/channels + 聊天卡片输入框下拉补全(键盘导航+点击选中)

This commit is contained in:
2026-08-07 19:55:32 +08:00
parent 0e622329a7
commit 62b6ff44d1
7 changed files with 147 additions and 2 deletions
+12
View File
@@ -139,6 +139,18 @@ func registerAPIRoutes(r gin.IRouter, store *storepkg.Store, mapTileCacheDir str
rows, err := store.ListTextMessages(opts)
writeListResponse(c, rows, opts, err, textMessageDTO)
})
r.GET("/channels", func(c *gin.Context) {
rows, err := store.ListChannels()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
items := make([]gin.H, 0, len(rows))
for _, row := range rows {
items = append(items, gin.H{"channel_id": row.ChannelID})
}
c.JSON(http.StatusOK, gin.H{"items": items})
})
r.GET("/discard-details", func(c *gin.Context) {
opts, ok := parseListOptions(c)
if !ok {