Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ build/
vendor/

app/dubbo-ui/dist/
/.env
10 changes: 7 additions & 3 deletions ai/cmd/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
type IndexCommand struct {
Directory string
ConfigPath string
IndexName string
}

func main() {
Expand All @@ -43,8 +44,9 @@ func main() {
func parseFlags() *IndexCommand {
cmd := &IndexCommand{}

flag.StringVar(&cmd.Directory, "dir", "/Users/liwener/programming/ospp/dubbo-admin/ai/reference/k8s_docs/concepts", "Directory to index (required)")
flag.StringVar(&cmd.Directory, "dir", "component/rag/seeds", "Directory to index (required)")
flag.StringVar(&cmd.ConfigPath, "config", "component/rag/rag.yaml", "Configuration file path")
flag.StringVar(&cmd.IndexName, "index", "default", "Target index name (must match the runtime retriever target)")

flag.Parse()
return cmd
Expand Down Expand Up @@ -115,8 +117,10 @@ func executeIndexing(cmd *IndexCommand) error {

g := genkit.Init(ctx, genkit.WithPlugins(plugins...))

// Build-time target index selection: default to directory name for this CLI
targetIndex := getNamespace("", cmd.Directory)
// Build-time target index selection. Default to "default" so the indexed data
// lands in the same target the runtime retriever reads from; fall back to the
// directory name only when explicitly cleared.
targetIndex := getNamespace(cmd.IndexName, cmd.Directory)

sys, err := buildRAGSystem(g, cfg)
if err != nil {
Expand Down
17 changes: 14 additions & 3 deletions ai/component/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,25 @@ Outer:
emitStageProgress(chans, order, false)

// Check if LLM returned final answer
if out, ok := output.(schema.Observation); ok {
finalFound := false
if out, ok := output.(*schema.Observation); ok {
if !out.Heartbeat && out.FinalAnswer != "" {
finalOutput = *out
finalFound = true
}
} else if out, ok := output.(schema.Observation); ok {
if !out.Heartbeat && out.FinalAnswer != "" {
finalOutput = out
break Outer
finalFound = true
}
}
if finalFound {
break Outer
}
// The output of current stage will be the input of the next stage
if val, ok := output.(schema.Observation); ok {
if val, ok := output.(*schema.Observation); ok {
finalOutput = *val
} else if val, ok := output.(schema.Observation); ok {
finalOutput = val
}
input = output
Expand Down
4 changes: 2 additions & 2 deletions ai/component/agent/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ spec:
agent_type: "react"
model: "dashscope/qwen3.5-plus"
prompt_base_path: "./prompts"
max_iterations: 10
max_iterations: 3 # Reduced from 10 to 3 for faster response
stage_channel_buffer_size: 5
mcp_host_name: "mcp_host"

Expand Down Expand Up @@ -32,5 +32,5 @@ spec:
temperature: 0.7
top_p: 0.9
max_tokens: 2000
timeout: 60
timeout: 30 # Reduced from 60 to 30 for faster timeout fallback
enable_tools: false
Loading