Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve database table view template col sorting https://ld246.com/article/1702871433047

Daniel305f781afa31
diff --git a/kernel/av/table.go b/kernel/av/table.go
index 1370a18a4a..69b161efec 100644
--- a/kernel/av/table.go
+++ b/kernel/av/table.go
@@ -176,9 +176,11 @@ func (value *Value) Compare(other *Value) int {
}
case KeyTypeTemplate:
if nil != value.Template && nil != other.Template {
- if util.IsNumeric(value.Template.Content) && util.IsNumeric(other.Template.Content) {
- v1, _ := strconv.ParseFloat(value.Template.Content, 64)
- v2, _ := strconv.ParseFloat(other.Template.Content, 64)
+ vContent := strings.TrimSpace(value.Template.Content)
+ oContent := strings.TrimSpace(other.Template.Content)
+ if util.IsNumeric(vContent) && util.IsNumeric(oContent) {
+ v1, _ := strconv.ParseFloat(vContent, 64)
+ v2, _ := strconv.ParseFloat(oContent, 64)
if v1 > v2 {
return 1
}