Skip to content

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

:fire: Remove code that nothing references

Jeffrey Chenb754ce5d9275
diff --git a/app/src/constants.ts b/app/src/constants.ts
index 9956cede4d..7e7f68c984 100644
--- a/app/src/constants.ts
+++ b/app/src/constants.ts
@@ -227,10 +227,6 @@ export abstract class Constants {
public static readonly LOCAL_AV_CALENDAR_MODES = "local-av-calendar-modes";
public static readonly LOCAL_TABS_READING = "local-tabs-reading";
public static readonly LOCAL_MINDMAP_VIEWPORTS = "local-mindmap-viewports";
- /** @deprecated 内置偏好改用 config.appearance.compactMode,不再读取此旧键 */
- public static readonly LOCAL_COMPACT_MODE = "local-compact-mode";
- /** @deprecated 内置偏好改用 config.appearance.menuMouseScroll,不再读取此旧键 */
- public static readonly LOCAL_MENU_MOUSE_SCROLL = "local-menu-mouse-scroll";
// dialog
public static readonly DIALOG_CONFIRM = "dialog-confirm";
diff --git a/kernel/agent/modelmeta_online.go b/kernel/agent/modelmeta_online.go
index 0837c0cf10..8464fb3663 100644
--- a/kernel/agent/modelmeta_online.go
+++ b/kernel/agent/modelmeta_online.go
@@ -85,11 +85,6 @@ var (
}{}
)
-// StartModelMetadataRefresh 在后台刷新 models.dev 模型目录,不阻塞内核启动。
-func StartModelMetadataRefresh() {
- refreshModelsDevContextCatalogAsync()
-}
-
func getModelsDevContextLimit(providerBaseURL, model string) int {
if providerBaseURL == "" || model == "" {
return 0
diff --git a/kernel/apicontract/document_legacy.go b/kernel/apicontract/document_legacy.go
index 729c95430c..a1e29842de 100644
--- a/kernel/apicontract/document_legacy.go
+++ b/kernel/apicontract/document_legacy.go
@@ -25,9 +25,6 @@ func NewLegacyPathIDsFailure(value LegacyPathUnsupported) LegacyPathIDsResult {
return LegacyPathIDsResult{failure: &value}
}
func NewLegacyPathIDs(value []string) LegacyPathIDsResult { return LegacyPathIDsResult{value: value} }
-func UnsupportedLegacyPathIDs() LegacyPathIDsResult {
- return LegacyPathIDsResult{failure: &LegacyPathUnsupported{Reason: "legacyPathUnsupported"}}
-}
func (result LegacyPathIDsResult) MarshalJSON() ([]byte, error) {
if result.failure != nil {
return json.Marshal(result.failure)
@@ -46,9 +43,6 @@ func NewLegacyPathDocumentFailure(value LegacyPathUnsupported) LegacyPathDocumen
func NewLegacyPathDocument(value string) LegacyPathDocumentResult {
return LegacyPathDocumentResult{value: value}
}
-func UnsupportedLegacyPathDocument() LegacyPathDocumentResult {
- return LegacyPathDocumentResult{failure: &LegacyPathUnsupported{Reason: "legacyPathUnsupported"}}
-}
func (result LegacyPathDocumentResult) MarshalJSON() ([]byte, error) {
if result.failure != nil {
return json.Marshal(result.failure)
diff --git a/kernel/av/capabilities.go b/kernel/av/capabilities.go
index 73f804a82e..f6f5331c96 100644
--- a/kernel/av/capabilities.go
+++ b/kernel/av/capabilities.go
@@ -132,10 +132,6 @@ var filterOperators = []FilterOperator{
FilterOperatorStartsWith, FilterOperatorEndsWith, FilterOperatorIsBetween, FilterOperatorIsTrue, FilterOperatorIsFalse,
}
-func FilterOperators() []FilterOperator {
- return append([]FilterOperator(nil), filterOperators...)
-}
-
func IsDateKeyType(typ KeyType) bool {
kind := GetKeyCapability(typ).ValueKind
return kind == "date" || kind == "timestamp"
diff --git a/kernel/av/value.go b/kernel/av/value.go
index e2aaef8e1e..1f78202ce7 100644
--- a/kernel/av/value.go
+++ b/kernel/av/value.go
@@ -2544,11 +2544,6 @@ func NewFormattedValueDate(content, content2 int64, format DateFormat, isNotTime
return
}
-// Round rounds to nearest like 12.3456 -> 12.35
-func Round(val float64, precision int) float64 {
- return math.Round(val*(math.Pow10(precision))) / math.Pow10(precision)
-}
-
type ValueSelect struct {
Content string `json:"content"`
Color string `json:"color"` // 1-78
diff --git a/kernel/livephoto/manager.go b/kernel/livephoto/manager.go
index 2111523f54..622774bbdf 100644
--- a/kernel/livephoto/manager.go
+++ b/kernel/livephoto/manager.go
@@ -214,14 +214,6 @@ func (m *Manager) lookup(id string) (*previewJob, error) {
return job, nil
}
-func (m *Manager) Scope(id string) (string, error) {
- job, err := m.lookup(id)
- if err != nil {
- return "", err
- }
- return job.scope, nil
-}
-
func (m *Manager) Origin(id string) (string, error) {
job, err := m.lookup(id)
if err != nil {
diff --git a/kernel/model/auth.go b/kernel/model/auth.go
index 02d7bede97..996732de44 100644
--- a/kernel/model/auth.go
+++ b/kernel/model/auth.go
@@ -190,12 +190,6 @@ func AddSession(username, credentialVersion string) string {
return sessionID
}
-func DeleteSession(sessionID string) {
- sessionLock.Lock()
- defer sessionLock.Unlock()
- delete(sessionsMap, sessionID)
-}
-
// purgeExpiredPublishSessions 删除空闲超过 publishSessionTTL 的会话,调用方需持有 sessionLock。
func purgeExpiredPublishSessions(now time.Time) {
for id, session := range sessionsMap {
diff --git a/kernel/model/bazaar.go b/kernel/model/bazaar.go
index f88886c26b..a5e4f782b3 100644
--- a/kernel/model/bazaar.go
+++ b/kernel/model/bazaar.go
@@ -156,11 +156,6 @@ func filterUpdatableBazaarPackages(packages []*UpdatedPackage) (updatable []*Upd
return
}
-// BatchUpdatePackages 更新所有集市包
-func BatchUpdatePackages(frontend string) error {
- return BatchUpdatePackagesContext(context.Background(), frontend)
-}
-
// BatchUpdatePackagesContext 取消时保留已提交的包,并停止当前下载和后续更新。
func BatchUpdatePackagesContext(ctx context.Context, frontend string) error {
if err := ctx.Err(); err != nil {
diff --git a/kernel/model/block.go b/kernel/model/block.go
index 44976fdf7f..dc95d4c504 100644
--- a/kernel/model/block.go
+++ b/kernel/model/block.go
@@ -132,12 +132,6 @@ func newBlockRefCheckGroup() *blockRefCheckGroup {
}
}
-// CheckBlockRef 检查将被删除的块是否被引用或绑定到仍存在的数据库。
-func CheckBlockRef(ids []string) bool {
- ret, _ := CheckBlockRefInBox(ids, nil, ids, "")
- return ret
-}
-
// CheckBlockRefInBox 检查受影响块的引用,并检查实际删除块的数据库绑定。
func CheckBlockRefInBox(ids, exactIDs, deletedIDs []string, boxID string) (ret bool, err error) {
sql.FlushQueue()
@@ -398,10 +392,6 @@ type BlockTreeInfo struct {
NextType string `json:"nextType"`
}
-func GetBlockTreeInfos(ids []string) (ret map[string]*BlockTreeInfo) {
- return GetBlockTreeInfosInBox(ids, "")
-}
-
// GetBlockTreeInfosInBox 获取指定笔记本内的块树信息。空 box 仅查询普通全局库。
func GetBlockTreeInfosInBox(ids []string, boxID string) (ret map[string]*BlockTreeInfo) {
ret = map[string]*BlockTreeInfo{}
@@ -457,10 +447,6 @@ func GetBlockTreeInfosInBox(ids []string, boxID string) (ret map[string]*BlockTr
return
}
-func GetBlockSiblingID(id string) (parent, previous, next string) {
- return GetBlockSiblingIDInBox(id, "")
-}
-
// GetBlockSiblingIDInBox 获取指定笔记本内块的相邻关系。空 box 不回退搜索加密笔记本。
func GetBlockSiblingIDInBox(id, boxID string) (parent, previous, next string) {
tree := loadTreeForBlockDOM(id, boxID)
@@ -572,10 +558,6 @@ func getPreNext(parent *ast.Node) (previous, next string) {
return
}
-func GetBlockRelevantIDs(id string) (parentID, previousID, nextID string, err error) {
- return GetBlockRelevantIDsInBox(id, "")
-}
-
// GetBlockRelevantIDsInBox 获取指定笔记本内块的父级及相邻块 ID。空 box 不回退搜索加密笔记本。
func GetBlockRelevantIDsInBox(id, boxID string) (parentID, previousID, nextID string, err error) {
tree := loadTreeForBlockDOM(id, boxID)
@@ -1068,10 +1050,6 @@ func prepareHeadingChildrenDOMNodes(heading *ast.Node, children []*ast.Node, rem
return
}
-func GetHeadingLevelTransaction(id string, level int) (transaction *Transaction, err error) {
- return GetHeadingLevelBatchTransaction([]string{id}, level)
-}
-
func GetHeadingLevelBatchTransaction(ids []string, level int) (transaction *Transaction, err error) {
if len(ids) == 0 || level < 1 || 6 < level {
return
@@ -1216,10 +1194,6 @@ func GetBlockDOMInBox(id, boxID string) (ret string) {
return
}
-func GetBlockDOMs(ids []string) (ret map[string]string) {
- return GetBlockDOMsInBox(ids, "")
-}
-
// GetBlockDOMsInBox 渲染指定笔记本内的块 DOM。禁止在 boxID 未指定时遍历加密笔记本。
func GetBlockDOMsInBox(ids []string, boxID string) (ret map[string]string) {
ret = map[string]string{}
@@ -1254,15 +1228,6 @@ func GetBlockDOMsInBox(ids []string, boxID string) (ret map[string]string) {
return
}
-func GetBlockDOMWithEmbed(id string) (ret string) {
- return GetBlockDOMWithEmbedInBox(id, "")
-}
-
-// GetBlockDOMWithEmbedInBox 渲染指定笔记本内包含嵌入块的 DOM。
-func GetBlockDOMWithEmbedInBox(id, boxID string) (ret string) {
- return GetBlockDOMWithEmbedInBoxWithAccessChecker(id, boxID, nil)
-}
-
// EmbedBlockAccessChecker 判断嵌入查询结果块是否允许返回。
type EmbedBlockAccessChecker func(blockID string) bool
@@ -1277,15 +1242,6 @@ func GetBlockDOMWithEmbedInBoxWithAccessChecker(id, boxID string, accessChecker
return
}
-func GetBlockDOMsWithEmbed(ids []string) (ret map[string]string) {
- return GetBlockDOMsWithEmbedInBox(ids, "")
-}
-
-// GetBlockDOMsWithEmbedInBox 渲染指定笔记本内包含嵌入块的 DOM。boxID 为空时仅查询普通全局库。
-func GetBlockDOMsWithEmbedInBox(ids []string, boxID string) (ret map[string]string) {
- return GetBlockDOMsWithEmbedInBoxWithAccessChecker(ids, boxID, nil)
-}
-
// GetBlockDOMsWithEmbedInBoxWithAccessChecker 按访问权限渲染指定笔记本内包含嵌入块的 DOM。
func GetBlockDOMsWithEmbedInBoxWithAccessChecker(ids []string, boxID string, accessChecker EmbedBlockAccessChecker) (ret map[string]string) {
ret = map[string]string{}
@@ -1699,10 +1655,6 @@ func childBlockFromNode(node *ast.Node, tree *parse.Tree) *ChildBlock {
}
}
-func GetTailChildBlocks(id string, n int) (ret []*ChildBlock) {
- return GetTailChildBlocksInBox(id, n, "")
-}
-
// GetTailChildBlocksInBox 返回指定笔记本边界内末尾的子块。
func GetTailChildBlocksInBox(id string, n int, boxID string) (ret []*ChildBlock) {
ret = []*ChildBlock{}
diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go
index ec1faab6ee..921960c56d 100644
--- a/kernel/model/blockinfo.go
+++ b/kernel/model/blockinfo.go
@@ -493,10 +493,6 @@ func GetBlockRefIDsByFileAnnotationIDInBox(id, boxID string) []string {
return sql.QueryRefIDsByAnnotationIDInBox(id, boxID)
}
-func GetBlockDefIDsByRefText(refText string) (ret []string) {
- return GetBlockDefIDsByRefTextInBox(refText, "")
-}
-
func GetBlockDefIDsByRefTextInBox(refText, boxID string) (ret []string) {
if boxID == "" {
ret = sql.QueryBlockDefIDsByRefText(refText)
@@ -646,10 +642,6 @@ func BuildBlockBreadcrumbInBox(id string, excludeTypes []string, boxID string) (
return
}
-func GetBlockBreadcrumbChildren(id string, excludeTypes []string, offset, limit int) (ret *BlockBreadcrumbChildren, err error) {
- return GetBlockBreadcrumbChildrenInBox(id, excludeTypes, offset, limit, "")
-}
-
func GetBlockBreadcrumbChildrenInBox(id string, excludeTypes []string, offset, limit int, boxID string) (
ret *BlockBreadcrumbChildren, err error) {
ret = &BlockBreadcrumbChildren{Items: []*BlockPath{}}
diff --git a/kernel/model/daily_note.go b/kernel/model/daily_note.go
index 5f622355e7..95d04ab3fc 100644
--- a/kernel/model/daily_note.go
+++ b/kernel/model/daily_note.go
@@ -18,15 +18,6 @@ type DailyNoteInfo struct {
Existed bool
}
-// resolveDailyNote 定位日期对应的文档;已有日记以认证后的源文档为准。
-func resolveDailyNote(box *Box, now time.Time, findByDate bool) (hPath string, tree *parse.Tree, err error) {
- plan, tree, err := resolveDailyNotePlan(box, now, findByDate)
- if plan != nil {
- hPath = plan.DisplayPath
- }
- return
-}
-
func resolveDailyNotePlan(box *Box, now time.Time, findByDate bool) (plan *DocumentCreatePlan, tree *parse.Tree, err error) {
boxConf := box.GetConf()
if boxConf.DailyNoteTarget == nil && (boxConf.DailyNoteSavePath == "" || boxConf.DailyNoteSavePath == "/") {
diff --git a/kernel/model/encrypted_ops.go b/kernel/model/encrypted_ops.go
index 7d0d4fd96d..2c4ebfac28 100644
--- a/kernel/model/encrypted_ops.go
+++ b/kernel/model/encrypted_ops.go
@@ -17,12 +17,10 @@
package model
import (
- "github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode"
)
// 本文件提供加密笔记本的专用操作函数。每个函数接收 boxID,路由到加密 db。
-// 与原函数(GetBlockRefText、GetDoc 等)完全独立,原函数行为不变。
// 调用方为 API handler 层:当请求带 notebook 参数且为加密笔记本时,调这里的 InBox 版。
// GetBlockRefTextInBox 在指定加密笔记本内解析块引锚文本。
@@ -46,8 +44,3 @@ func GetBlockRefTextInBox(id, boxID string) string {
return getNodeRefText(node)
}
-
-// GetRefTextInBox 在指定加密笔记本内查块的引用文本(SQL 查询版,不走文件系统)。
-func GetRefTextInBox(defBlockID, boxID string) string {
- return sql.GetRefTextInBox(defBlockID, boxID)
-}
diff --git a/kernel/model/export_options.go b/kernel/model/export_options.go
index 91a1b14e68..199218f58d 100644
--- a/kernel/model/export_options.go
+++ b/kernel/model/export_options.go
@@ -59,10 +59,6 @@ func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath s
return ExportPandocConvertZipWithOptions(ids, pandocTo, ext, nil)
}
-func ExportNotebookMarkdown(boxID string) (zipPath string) {
- return ExportNotebookMarkdownWithOptions(boxID, nil)
-}
-
func ExportNotebooksMarkdown(boxIDs []string) (zipPath string) {
return ExportNotebooksMarkdownWithOptions(boxIDs, nil)
}
diff --git a/kernel/model/search.go b/kernel/model/search.go
index 4352a52e46..076871a6f5 100644
--- a/kernel/model/search.go
+++ b/kernel/model/search.go
@@ -320,10 +320,6 @@ func GetQueryEmbedStatement(embedBlockID string) (stmt, boxID string, err error)
return
}
-func SearchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock) {
- return SearchEmbedBlockInBox(embedBlockID, stmt, excludeIDs, headingMode, breadcrumb, "")
-}
-
// SearchEmbedBlockInBox 与 SearchEmbedBlock 一致,但按 boxID 路由 SQL 到加密 content db。
// 加密笔记本的嵌入块查询走独立加密库(全局 siyuan.db 不含加密数据),boxID 为空时落回全局库。
func SearchEmbedBlockInBox(embedBlockID, stmt string, excludeIDs []string, headingMode int, breadcrumb bool, boxID string) (ret []*EmbedBlock) {
@@ -600,10 +596,6 @@ func filterSelfHPath(blocks []*Block) {
}
}
-func trimSelfHPath(hPath string) string {
- return trimDocumentTitleHPath(hPath, "")
-}
-
func trimDocumentTitleHPath(hPath, title string) string {
inTag := false
var separators []int
@@ -3360,10 +3352,6 @@ func fromSQLBlockWithHPathTermsContext(ctx context.Context, sqlBlock *sql.Block,
return
}
-func markBlockHPath(block *Block, hPath, terms string, beforeLen int) {
- markBlockHPathContext(context.Background(), block, hPath, terms, beforeLen)
-}
-
func markBlockHPathContext(ctx context.Context, block *Block, hPath, terms string, beforeLen int) {
hPath, _ = markSearchContext(ctx, hPath, terms, beforeLen, false)
if !strings.HasPrefix(hPath, "/") {
diff --git a/kernel/model/search_attribute_view.go b/kernel/model/search_attribute_view.go
index a0ae887d7f..94389096ba 100644
--- a/kernel/model/search_attribute_view.go
+++ b/kernel/model/search_attribute_view.go
@@ -27,11 +27,6 @@ type attributeViewSearchPart struct {
ranges []attributeViewSearchRange
}
-// compactAttributeViewSearchResults 只精简已命中的数据库块,不改变索引、结果数量和排序。
-func compactAttributeViewSearchResults(blocks []*Block) {
- compactAttributeViewSearchResultsContext(context.Background(), blocks)
-}
-
func compactAttributeViewSearchResultsContext(ctx context.Context, blocks []*Block) {
for _, block := range blocks {
if ctx.Err() != nil {
diff --git a/kernel/model/tag.go b/kernel/model/tag.go
index 13e237d91c..596991ac78 100644
--- a/kernel/model/tag.go
+++ b/kernel/model/tag.go
@@ -262,10 +262,6 @@ func renameTag(oldLabel, newLabel string, beforeCommit func()) (err error) {
type TagBlocks []*Block
-func (s TagBlocks) Len() int { return len(s) }
-func (s TagBlocks) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s TagBlocks) Less(i, j int) bool { return s[i].ID < s[j].ID }
-
type Tag struct {
Name string `json:"name"`
Label string `json:"label"`
diff --git a/kernel/sql/encrypted_query.go b/kernel/sql/encrypted_query.go
index 265d2f466c..2d891abdda 100644
--- a/kernel/sql/encrypted_query.go
+++ b/kernel/sql/encrypted_query.go
@@ -132,21 +132,6 @@ func GetBlocksInBoxContext(ctx context.Context, ids []string, boxID string) (ret
return
}
-// GetRefTextInBox 按 defBlockID 在指定 box 的 db 里查引用文本。
-func GetRefTextInBox(defBlockID, boxID string) (ret string) {
- row := queryRowForBox(boxID, "SELECT content FROM blocks WHERE id = ?", defBlockID)
- if row == nil {
- return
- }
- if err := row.Scan(&ret); err != nil {
- if err != sql.ErrNoRows {
- logging.LogErrorf("sql query failed: %s", err)
- }
- ret = ""
- }
- return
-}
-
// QueryRefsByDefIDInBox 按 defBlockID 在指定 box 的 db 里查引用列表。
// containChildren 为 true 时递归查询定义块及其所有子块,与 QueryRefsByDefID 保持一致。
func QueryRefsByDefIDInBox(defBlockID string, containChildren bool, boxID string) (ret []*Ref) {
@@ -486,12 +471,6 @@ func SelectBlocksRegexInBox(stmt string, exp *regexp.Regexp, name, alias, memo,
return
}
-// SelectBlocksRegexArgsInBox 与 SelectBlocksRegexInBox 一致,但通过绑定参数执行。
-func SelectBlocksRegexArgsInBox(stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, page, pageSize int, boxID string, args ...any) (ret []*Block) {
- ret, _ = SelectBlocksRegexArgsInBoxContext(context.Background(), stmt, exp, name, alias, memo, ial, page, pageSize, boxID, args...)
- return
-}
-
// SelectBlocksRegexArgsInBoxContext 同时中断数据库扫描和逐块正则高亮。
func SelectBlocksRegexArgsInBoxContext(ctx context.Context, stmt string, exp *regexp.Regexp, name, alias, memo, ial bool, page, pageSize int, boxID string, args ...any) (ret []*Block, err error) {
rows, err := queryForBoxContext(ctx, boxID, stmt, args...)
diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go
index 5281282159..1aa9b7d04b 100644
--- a/kernel/treenode/blocktree.go
+++ b/kernel/treenode/blocktree.go
@@ -296,26 +296,6 @@ func GetBlockTreeRootByHPath(boxID, hPath string) (ret *BlockTree) {
return
}
-func GetBlockTreeRootsByHPath(boxID, hPath string) (ret []*BlockTree) {
- hPath = gulu.Str.RemoveInvisible(hPath)
- sqlStmt := "SELECT * FROM blocktrees WHERE box_id = ? AND hpath = ? AND type = 'd'"
- rows, err := queryForBox(boxID, sqlStmt, boxID, hPath)
- if err != nil {
- logging.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
- return
- }
- defer rows.Close()
- for rows.Next() {
- var block BlockTree
- if err = rows.Scan(&block.ID, &block.RootID, &block.ParentID, &block.BoxID, &block.Path, &block.HPath, &block.Updated, &block.Type); err != nil {
- logging.LogErrorf("query scan field failed: %s", err)
- return
- }
- ret = append(ret, &block)
- }
- return
-}
-
// GetBlockTreeRootByIDAndHPath 按笔记本、根块 ID 和原始 HPath 精确查找文档。
func GetBlockTreeRootByIDAndHPath(boxID, id, hPath string) (ret *BlockTree) {
ret = GetBlockTreeInExactBox(id, boxID)
@@ -672,10 +652,6 @@ func RemoveBlockTreesByBoxID(boxID string) (ids []string) {
return
}
-func RemoveBlockTreesByIDs(boxID string, ids []string) {
- RemoveBlockTreesByIDsWithError(boxID, ids)
-}
-
func RemoveBlockTreesByIDsWithError(boxID string, ids []string) error {
if 1 > len(ids) {
return nil
diff --git a/kernel/util/cloud.go b/kernel/util/cloud.go
index 6d36d0e37c..2a52e99301 100644
--- a/kernel/util/cloud.go
+++ b/kernel/util/cloud.go
@@ -18,10 +18,6 @@ package util
var CurrentCloudRegion = 0
-func IsChinaCloud() bool {
- return 0 == CurrentCloudRegion
-}
-
func GetCloudServer() string {
if 0 == CurrentCloudRegion {
return chinaServer
diff --git a/kernel/util/websearch.go b/kernel/util/websearch.go
index 09b4a577c2..c233700e67 100644
--- a/kernel/util/websearch.go
+++ b/kernel/util/websearch.go
@@ -70,10 +70,6 @@ type mcpContent struct {
Text string `json:"text"`
}
-func WebSearch(query, exaApiKey string) (string, error) {
- return WebSearchContext(context.Background(), query, exaApiKey, 0)
-}
-
func WebSearchContext(ctx context.Context, query, exaApiKey string, timeout int) (string, error) {
ctx, cancel := context.WithTimeout(ctx, time.Duration(NormalizeWebTimeout(timeout))*time.Second)
defer cancel()