An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Update av
Daniel6a31d345edcd
diff --git a/kernel/av/av.go b/kernel/av/av.goindex f2aa135483..be6006072b 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -172,8 +172,10 @@ func (number *ValueNumber) FormatNumber() {type ValueDate struct {Content int64 `json:"content"`- Content2 int64 `json:"content2"`+ IsNotEmpty bool `json:"isNotEmpty"`HasEndDate bool `json:"hasEndDate"`+ Content2 int64 `json:"content2"`+ IsNotEmpty2 bool `json:"isNotEmpty2"`FormattedContent string `json:"formattedContent"`}diff --git a/kernel/av/table.go b/kernel/av/table.goindex 7d430569b2..8f96c262e1 100644--- a/kernel/av/table.go+++ b/kernel/av/table.go@@ -199,9 +199,9 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool}return start && endcase FilterOperatorIsEmpty:- return 0 == value.Date.Content+ return !value.Date.IsNotEmptycase FilterOperatorIsNotEmpty:- return 0 != value.Date.Content+ return value.Date.IsNotEmptycase FilterOperatorIsRelativeToToday:// TODO: date filter (relative to today)return value.Date.Content >= other.Date.Content && value.Date.Content <= other.Date.Content2@@ -518,7 +518,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorCountValues:countValues := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {countValues++}}@@ -527,7 +527,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {countUniqueValues := 0uniqueValues := map[int64]bool{}for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {if _, ok := uniqueValues[row.Cells[colIndex].Value.Date.Content]; !ok {countUniqueValues++uniqueValues[row.Cells[colIndex].Value.Date.Content] = true@@ -538,7 +538,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorCountEmpty:countEmpty := 0for _, row := range table.Rows {- if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Date || 0 == row.Cells[colIndex].Value.Date.Content {+ if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Date || !row.Cells[colIndex].Value.Date.IsNotEmpty {countEmpty++}}@@ -546,7 +546,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorCountNotEmpty:countNotEmpty := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {countNotEmpty++}}@@ -554,7 +554,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorPercentEmpty:countEmpty := 0for _, row := range table.Rows {- if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Date || 0 == row.Cells[colIndex].Value.Date.Content {+ if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Date || !row.Cells[colIndex].Value.Date.IsNotEmpty {countEmpty++}}@@ -564,7 +564,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorPercentNotEmpty:countNotEmpty := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {countNotEmpty++}}@@ -574,7 +574,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorEarliest:earliest := int64(0)for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {if 0 == earliest || earliest > row.Cells[colIndex].Value.Date.Content {earliest = row.Cells[colIndex].Value.Date.Content}@@ -586,7 +586,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {case CalcOperatorLatest:latest := int64(0)for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {if 0 == latest || latest < row.Cells[colIndex].Value.Date.Content {latest = row.Cells[colIndex].Value.Date.Content}@@ -599,7 +599,7 @@ func (table *Table) calcColDate(col *TableColumn, colIndex int) {earliest := int64(0)latest := int64(0)for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && 0 != row.Cells[colIndex].Value.Date.Content {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Date && row.Cells[colIndex].Value.Date.IsNotEmpty {if 0 == earliest || earliest > row.Cells[colIndex].Value.Date.Content {earliest = row.Cells[colIndex].Value.Date.Content}@@ -621,7 +621,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorCountValues:countValues := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {countValues++}}@@ -630,7 +630,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {countUniqueValues := 0uniqueValues := map[float64]bool{}for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {if !uniqueValues[row.Cells[colIndex].Value.Number.Content] {uniqueValues[row.Cells[colIndex].Value.Number.Content] = truecountUniqueValues++@@ -641,7 +641,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorCountEmpty:countEmpty := 0for _, row := range table.Rows {- if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Number && !row.Cells[colIndex].Value.Number.IsNotEmpty {+ if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Number || !row.Cells[colIndex].Value.Number.IsNotEmpty {countEmpty++}}@@ -649,7 +649,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorCountNotEmpty:countNotEmpty := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {countNotEmpty++}}@@ -657,7 +657,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorPercentEmpty:countEmpty := 0for _, row := range table.Rows {- if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Number && !row.Cells[colIndex].Value.Number.IsNotEmpty {+ if nil == row.Cells[colIndex] || nil == row.Cells[colIndex].Value || nil == row.Cells[colIndex].Value.Number || !row.Cells[colIndex].Value.Number.IsNotEmpty {countEmpty++}}@@ -667,7 +667,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorPercentNotEmpty:countNotEmpty := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {countNotEmpty++}}@@ -677,7 +677,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorSum:sum := 0.0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {sum += row.Cells[colIndex].Value.Number.Content}}@@ -686,7 +686,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {sum := 0.0count := 0for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {sum += row.Cells[colIndex].Value.Number.Contentcount++}@@ -697,7 +697,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorMedian:values := []float64{}for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {values = append(values, row.Cells[colIndex].Value.Number.Content)}}@@ -712,7 +712,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorMin:min := math.MaxFloat64for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {if row.Cells[colIndex].Value.Number.Content < min {min = row.Cells[colIndex].Value.Number.Content}@@ -724,7 +724,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {case CalcOperatorMax:max := -math.MaxFloat64for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {if row.Cells[colIndex].Value.Number.Content > max {max = row.Cells[colIndex].Value.Number.Content}@@ -737,7 +737,7 @@ func (table *Table) calcColNumber(col *TableColumn, colIndex int) {min := math.MaxFloat64max := -math.MaxFloat64for _, row := range table.Rows {- if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && (row.Cells[colIndex].Value.Number.IsNotEmpty || 0 != row.Cells[colIndex].Value.Number.Content) {+ if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Number && row.Cells[colIndex].Value.Number.IsNotEmpty {if row.Cells[colIndex].Value.Number.Content < min {min = row.Cells[colIndex].Value.Number.Content}