Skip to content

Commit fcaf706

Browse files
committed
chore: update frontend assets and dependencies, adjust model config
1. 更新前端静态资源文件,替换旧的打包产物为新的版本 2. 升级github.com/DotNetAge/goharness依赖到v0.2.14 3. 调整deepseek模型的max_tokens配置到384000 4. 优化本地搜索工具的空数据预检查逻辑 5. 更新技能提示文案,规范技能加载流程 6. 调整令牌使用统计逻辑,优化计费统计方式 7. 更新前端页面引用的脚本和样式文件路径
1 parent 3ada287 commit fcaf706

80 files changed

Lines changed: 120 additions & 111 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
require (
2626
github.com/DotNetAge/gochat v0.2.7
2727
github.com/DotNetAge/gograph v0.2.6
28-
github.com/DotNetAge/goharness v0.2.13
28+
github.com/DotNetAge/goharness v0.2.14
2929
github.com/DotNetAge/gorag/v2 v2.0.8
3030
github.com/creack/pty v1.1.24
3131
go.etcd.io/bbolt v1.4.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ github.com/DotNetAge/gochat v0.2.7 h1:W06T9dRx46QlWkFDlpRSGtpdgNb8m9meTPxycRX/xZ
1515
github.com/DotNetAge/gochat v0.2.7/go.mod h1:w7m36rMZoDwmReJNTLUGHhok6DSqnIidg9wFKwYM1dM=
1616
github.com/DotNetAge/gograph v0.2.6 h1:LhYERtYTPaWXvbBy9bO/6XGmYTW/OZGXQ+zyfycsexo=
1717
github.com/DotNetAge/gograph v0.2.6/go.mod h1:Ia2wvbkpdJvFJEZ1vw+IklbhNbWjPli2dnU21jbmy7I=
18-
github.com/DotNetAge/goharness v0.2.13 h1:MkGvj7+3UadfSpb3kz3F0Gb1NhI8L0e5CKhw3dOAgaQ=
19-
github.com/DotNetAge/goharness v0.2.13/go.mod h1:2+Ze4Att5hP3oRR9/5Rqv506hr38G5qwaWQz6ChOu8c=
18+
github.com/DotNetAge/goharness v0.2.14 h1:HcmLvzKQDIly6NO0HUPPBW0IbStR/DJkdAl0yDp5DYY=
19+
github.com/DotNetAge/goharness v0.2.14/go.mod h1:2+Ze4Att5hP3oRR9/5Rqv506hr38G5qwaWQz6ChOu8c=
2020
github.com/DotNetAge/gorag/v2 v2.0.8 h1:TmPnZvkirhAm1GLzw42hTIA1xUtIMa4TpydpeaDGNt8=
2121
github.com/DotNetAge/gorag/v2 v2.0.8/go.mod h1:K8YAydeJR41JMY59xrzgMNDKRHVg3cwB2pYwJSwVjbE=
2222
github.com/DotNetAge/gort v0.1.4 h1:nUZdy3cN3Kif21GWIYkxlIS/iFr62eN5boBmCzmI3xw=

internal/core/app.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,7 @@ func (a *App) createRuntime(agentName string) (*agents.Runtime, error) {
537537
opts = append(opts, agents.WithEnvs(a.envsOverride))
538538
}
539539

540-
// Check if the current project has indexed data in the knowledge base
541-
hasLocalData := false
542-
if a.graphIndexer != nil && a.currentSessionMeta != nil && a.currentSessionMeta.ProjectDir != "" {
543-
total, err := a.graphIndexer.CountByRegion(context.Background(), a.currentSessionMeta.ProjectDir)
544-
if err == nil && total > 0 {
545-
hasLocalData = true
546-
a.logger.Info("createRuntime: project has indexed data, LocalSearch will be enabled",
547-
"project_dir", a.currentSessionMeta.ProjectDir, "total", total)
548-
} else {
549-
a.logger.Info("createRuntime: no indexed data for project, LocalSearch will be skipped",
550-
"project_dir", a.currentSessionMeta.ProjectDir, "total", total, "error", err)
551-
}
552-
}
553-
554-
if a.searchStrategyOverride != nil && hasLocalData {
540+
if a.searchStrategyOverride != nil && a.graphIndexer != nil {
555541
opts = append(opts, agents.WithSearchStrategy(a.searchStrategyOverride))
556542
}
557543

@@ -636,8 +622,10 @@ func (a *App) createRuntime(agentName string) (*agents.Runtime, error) {
636622
rt := agents.NewRuntime(opts...)
637623
a.logger.Info("createRuntime: done", "agent", agentName)
638624

639-
// Register LocalSearch if the project has indexed data in knowledge base
640-
if hasLocalData {
625+
// Register LocalSearch whenever the graph indexer is available.
626+
// The tool resolves projectDir at runtime from the session/cwd,
627+
// so we do not depend on currentSessionMeta here.
628+
if a.graphIndexer != nil {
641629
ls := mindxtools.NewLocalSearch(a.graphIndexer)
642630
if err := rt.RegisterTool(ls); err != nil {
643631
a.logger.Warn("createRuntime: failed to register LocalSearch", "agent", agentName, "error", err)

internal/svc/event_dispatcher.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,19 @@ func (d *Daemon) sendExecutionSummary(clientID, sessionID string, summary goharn
3434
if d.gw == nil {
3535
return
3636
}
37-
d.logger.Debug("sendExecutionSummary",
38-
"total_tokens", summary.TokensUsed.TotalTokens,
39-
"input", summary.TokensUsed.InputTokens,
40-
"output", summary.TokensUsed.OutputTokens)
4137
tokensUsed := summary.TokensUsed
38+
// Effective token consumption: cached/reused tokens should not be counted as billed usage.
39+
effectiveTotal := tokensUsed.InputTokens + tokensUsed.OutputTokens - tokensUsed.CachedTokens
40+
if effectiveTotal < 0 {
41+
effectiveTotal = 0
42+
}
43+
d.logger.Debug("sendExecutionSummary",
44+
"effective_total", effectiveTotal,
45+
"input", tokensUsed.InputTokens,
46+
"output", tokensUsed.OutputTokens,
47+
"cached", tokensUsed.CachedTokens)
4248
tokenValue := fmt.Sprintf("%d (in:%d out:%d cached:%d reasoning:%d)",
43-
tokensUsed.TotalTokens, tokensUsed.InputTokens, tokensUsed.OutputTokens,
49+
effectiveTotal, tokensUsed.InputTokens, tokensUsed.OutputTokens,
4450
tokensUsed.CachedTokens, tokensUsed.ReasoningTokens)
4551
tableData := map[string]any{
4652
"headers": []string{"Metric", "Value"},
@@ -57,11 +63,11 @@ func (d *Daemon) sendExecutionSummary(clientID, sessionID string, summary goharn
5763
gateway.WithSessionID(sessionID),
5864
gateway.WithResponseMeta(map[string]any{
5965
"tokens_used": map[string]any{
60-
"total_tokens": summary.TokensUsed.TotalTokens,
61-
"input_tokens": summary.TokensUsed.InputTokens,
62-
"output_tokens": summary.TokensUsed.OutputTokens,
63-
"cached_tokens": summary.TokensUsed.CachedTokens,
64-
"reasoning_tokens": summary.TokensUsed.ReasoningTokens,
66+
"total_tokens": effectiveTotal,
67+
"input_tokens": tokensUsed.InputTokens,
68+
"output_tokens": tokensUsed.OutputTokens,
69+
"cached_tokens": tokensUsed.CachedTokens,
70+
"reasoning_tokens": tokensUsed.ReasoningTokens,
6571
},
6672
"iterations": summary.TotalIterations,
6773
"tool_calls": summary.ToolCalls,
@@ -93,11 +99,8 @@ func buildSubtaskCompletedMarkdown(result goharnessevents.SubtaskResult) string
9399
}
94100

95101
func buildTaskSummaryMarkdown(ts goharnessevents.TaskSummaryData) string {
96-
return fmt.Sprintf("### %s\n\n%s\n\n**%s**: %s %s / %s %s / %s %s\n",
97-
i18n.T("svc.md.task.summary"), ts.Summary,
98-
i18n.T("svc.md.task.token"), i18n.T("svc.md.token.input"), formatTokenCount(ts.TokenUsage.InputTokens),
99-
i18n.T("svc.md.token.output"), formatTokenCount(ts.TokenUsage.OutputTokens),
100-
i18n.T("svc.md.token.total"), formatTokenCount(ts.TokenUsage.TotalTokens))
102+
return fmt.Sprintf("### %s\n\n%s\n",
103+
i18n.T("svc.md.task.summary"), ts.Summary)
101104
}
102105

103106
// formatTokenCount converts a large number to a human-readable K/M format.

internal/svc/prompts.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ func NewSkillsPrompt() func([]*skill.Skill) string {
2626
"When your existing tools cannot fully address the user's request, check whether one of the following specialized skills covers the domain. If a skill matches, use the Skill tool to load its instructions, which will guide you through domain-specific workflows and expose additional tools.\n"
2727

2828
footer := "\n### Loading Strategy\n" +
29-
"- Load skills LAZILY: only when you're about to perform a task that requires it\n" +
30-
"- Each skill persists once loaded into conversation context \u2014 do NOT reload already-loaded skills\n" +
31-
"- To view detailed descriptions of a skill, use `mindx skill list -f \"<skill_name>,<skill_name>,...\"`\n"
29+
"Capacities lists your role's standard tools. When a task matches a listed skill's domain:\n" +
30+
"1. Use `mindx skill list -f \"<skill1_name>,<skill2_name>,...\"` to check current description\n" +
31+
"2. Confirm matching → Load via Skill tool → Execute per instructions\n" +
32+
"Only skip loading if you have verified no skill in Capacities matches the task.\n" +
33+
"Forbidden: Starting domain work without first loading the corresponding skill."
3234

3335
var nameBuilder strings.Builder
3436
for _, s := range skills {
@@ -66,10 +68,10 @@ func NewEnvironmentPrompt(userPrefsDir, venvDir string) func(agents.EnvsParams)
6668
sb.WriteString(" A temporary workspace for the current conversation.\n")
6769
sb.WriteString(" Contents are deleted when the conversation ends — do NOT put important work here.\n")
6870

69-
if userPrefsDir != "" {
70-
sb.WriteString(fmt.Sprintf("- **User Prefs**: %s\n", userPrefsDir))
71-
sb.WriteString(" Application configuration, skills, and agent definitions.\n")
72-
}
71+
// if userPrefsDir != "" {
72+
// sb.WriteString(fmt.Sprintf("- **User Prefs**: %s\n", userPrefsDir))
73+
// sb.WriteString(" Application configuration, skills, and agent definitions.\n")
74+
// }
7375
if venvDir != "" {
7476
sb.WriteString(fmt.Sprintf("- **Python Venv Dir**: %s\n", venvDir))
7577
}

internal/tools/local_search.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ func (t *LocalSearch) Execute(ctx context.Context, params map[string]any) (any,
189189
if projectDir != "" {
190190
regionID := fmt.Sprintf("%x", sha256.Sum256([]byte(filepath.Clean(projectDir))))
191191
gq.AddFilter("region_id", regionID)
192+
193+
// Pre-check: skip search if no indexed data for this region
194+
total, countErr := t.indexer.CountByRegion(ctx, projectDir)
195+
if countErr == nil && total == 0 {
196+
return map[string]any{
197+
"message": "No data in local knowledge base yet. Use Grep/Glob/Read or WebSearch instead.",
198+
}, nil
199+
}
192200
}
193201

194202
hits, err := t.indexer.Search(ctx, gq)
@@ -265,6 +273,14 @@ func (t *LocalSearch) execTree(ctx context.Context, params map[string]any) (any,
265273
var regionID string
266274
if regionPath != "" {
267275
regionID = fmt.Sprintf("%x", sha256.Sum256([]byte(filepath.Clean(regionPath))))
276+
277+
// Pre-check: skip tree if no indexed data for this region
278+
total, countErr := t.indexer.CountByRegion(ctx, regionPath)
279+
if countErr == nil && total == 0 {
280+
return map[string]any{
281+
"message": "No data in local knowledge base yet. Use Ls/Glob to browse files instead.",
282+
}, nil
283+
}
268284
}
269285

270286
root, err := t.indexer.Tree(ctx, regionID, depth)

runtime/settings/models.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ models:
8888
provider: deepseek
8989
cost_per_1m_in: 3
9090
cost_per_1m_out: 6
91-
max_tokens: 131072
91+
max_tokens: 384000
9292
context_length: 1000000
9393
is_local: false
9494
func_calling: true
@@ -108,7 +108,7 @@ models:
108108
provider: deepseek
109109
cost_per_1m_in: 1
110110
cost_per_1m_out: 2
111-
max_tokens: 131072
111+
max_tokens: 384000
112112
context_length: 1000000
113113
is_local: false
114114
func_calling: true
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/web/assets/architecture-7EHR7CIX-BJiPBs-W.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import{x as e}from"./mermaid-parser.core-BuvNtBxX.js";export{e as createArchitectureServices};

0 commit comments

Comments
 (0)