Skip to content

Commit c355cb8

Browse files
committed
feat: add llm sessions and update related logic
1 parent becc175 commit c355cb8

34 files changed

+3098
-656
lines changed

.github/workflows/weblate-pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
- name: Update Repository
3030
env:
3131
WEBLATE_TOKEN: ${{ secrets.WEBLATE_TOKEN }}
32-
run: wlc --key $WEBLATE_TOKEN pull
32+
run: wlc --key $WEBLATE_TOKEN reset nginx-ui

api/config/rename.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,21 @@ func Rename(c *gin.Context) {
7676
}
7777

7878
// update LLM records
79-
g := query.LLMMessages
79+
g := query.LLMSession
8080
q := query.Config
8181
cfg, err := q.Where(q.Filepath.Eq(origFullPath)).FirstOrInit()
8282
if err != nil {
8383
cosy.ErrHandler(c, err)
8484
return
8585
}
8686
if !stat.IsDir() {
87-
_, _ = g.Where(g.Name.Eq(newFullPath)).Delete()
88-
_, _ = g.Where(g.Name.Eq(origFullPath)).Update(g.Name, newFullPath)
87+
_, _ = g.Where(g.Path.Eq(newFullPath)).Delete()
88+
_, _ = g.Where(g.Path.Eq(origFullPath)).Update(g.Path, newFullPath)
8989
// for file, the sync policy for this file is used
9090
json.SyncNodeIds = cfg.SyncNodeIds
9191
} else {
9292
// is directory, update all records under the directory
93-
_, _ = g.Where(g.Name.Like(origFullPath+"%")).Update(g.Name, g.Name.Replace(origFullPath, newFullPath))
93+
_, _ = g.Where(g.Path.Like(origFullPath+"%")).Update(g.Path, g.Path.Replace(origFullPath, newFullPath))
9494
}
9595

9696
_, err = q.Where(q.Filepath.Eq(origFullPath)).Updates(&model.Config{

api/llm/record.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

api/llm/router.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ package llm
33
import "github.com/gin-gonic/gin"
44

55
func InitRouter(r *gin.RouterGroup) {
6-
r.GET("llm_messages", GetLLMRecord)
7-
r.POST("llm_messages", StoreLLMRecord)
6+
// LLM Session endpoints
7+
r.GET("llm_sessions", GetLLMSessions)
8+
r.GET("llm_sessions/:session_id", GetLLMSession)
9+
r.POST("llm_sessions", CreateLLMSession)
10+
r.PUT("llm_sessions/:session_id", UpdateLLMSession)
11+
r.DELETE("llm_sessions/:session_id", DeleteLLMSession)
12+
r.POST("llm_sessions/:session_id/duplicate", DuplicateLLMSession)
13+
r.POST("llm_sessions/:session_id/generate_title", GenerateSessionTitle)
14+
15+
// Compatibility endpoints for legacy file-based sessions
16+
r.GET("llm_messages", GetLLMSessionByPath)
17+
r.POST("llm_messages", CreateOrUpdateLLMSessionByPath)
818
}
919

1020
// InitLocalRouter for main node only (no proxy)

0 commit comments

Comments
 (0)