ultisuite-backend/internal/nextcloud/ultichat_paths.go
R3D347HR4Y 0466a1c169
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
wow
2026-06-11 01:22:52 +02:00

28 lines
771 B
Go

package nextcloud
import "strings"
const (
UltichatSidecarSuffix = ".ultichat.json"
DefaultChatNCBasePath = "/.ultimail/ai/chats"
)
// ChatSidecarPath returns the WebDAV path for a chat history sidecar.
func ChatSidecarPath(basePath, chatID string) string {
basePath = NormalizeClientPath(basePath)
if basePath == "" || basePath == "/" {
basePath = DefaultChatNCBasePath
}
basePath = strings.TrimSuffix(basePath, "/")
id := strings.TrimSpace(chatID)
if id == "" {
return basePath + "/"
}
return basePath + "/" + id + UltichatSidecarSuffix
}
// IsUltichatSidecarPath reports whether path ends with .ultichat.json.
func IsUltichatSidecarPath(path string) bool {
return strings.HasSuffix(strings.ToLower(strings.TrimSpace(path)), UltichatSidecarSuffix)
}