mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-01 08:37:41 +02:00
Add files via upload
This commit is contained in:
@@ -1340,6 +1340,7 @@ func setupRoutes(
|
||||
protected.GET("/chat-uploads", chatUploadsHandler.List)
|
||||
protected.GET("/chat-uploads/export", chatUploadsHandler.Export)
|
||||
protected.GET("/chat-uploads/download", chatUploadsHandler.Download)
|
||||
protected.GET("/chat-uploads/path", chatUploadsHandler.ResolvePath)
|
||||
protected.GET("/chat-uploads/content", chatUploadsHandler.GetContent)
|
||||
protected.POST("/chat-uploads", chatUploadsHandler.Upload)
|
||||
protected.POST("/chat-uploads/mkdir", chatUploadsHandler.Mkdir)
|
||||
|
||||
@@ -111,6 +111,19 @@ func (db *DB) GetProject(id string) (*Project, error) {
|
||||
return &p, nil
|
||||
}
|
||||
|
||||
// GetProjectName returns a project display name without loading the full record.
|
||||
func (db *DB) GetProjectName(id string) (string, error) {
|
||||
var name string
|
||||
err := db.QueryRow(`SELECT name FROM projects WHERE id = ?`, id).Scan(&name)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return "", fmt.Errorf("项目不存在")
|
||||
}
|
||||
return "", fmt.Errorf("获取项目名称失败: %w", err)
|
||||
}
|
||||
return strings.TrimSpace(name), nil
|
||||
}
|
||||
|
||||
func projectListSearchPattern(q string) string {
|
||||
q = strings.TrimSpace(q)
|
||||
if q == "" {
|
||||
|
||||
Reference in New Issue
Block a user