28 lines
771 B
Go
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)
|
|
}
|