feat: Implement manual knowledge editing and enhance knowledge base features

- Added functionality for manual knowledge entry, allowing users to create and edit Markdown content directly in the browser.
- Introduced new API endpoints for creating and updating manual knowledge entries.
- Enhanced UI components to support the new manual knowledge editor, including integration with existing knowledge base features.
- Updated knowledge retrieval logic to accommodate manual entries, ensuring seamless user experience across knowledge types.
- Improved agent configuration to support custom system prompts, enhancing flexibility in agent responses.
This commit is contained in:
wizardchen
2025-11-12 21:27:56 +08:00
parent a342a0aa14
commit 69f3f30d83
36 changed files with 3495 additions and 412 deletions
+21
View File
@@ -577,6 +577,8 @@ func (e *AgentEngine) streamThinkingToEventBus(
}
logger.Debug(context.Background(), "[Agent] streamLLM opts tool_choice=auto temperature=", e.config.Temperature)
pendingToolCalls := make(map[string]bool)
// Generate a single ID for this entire thinking stream
thinkingID := generateEventID("thinking")
logger.Debugf(ctx, "[Agent][Thinking][Iteration-%d] ThinkingID: %s", iteration+1, thinkingID)
@@ -586,6 +588,25 @@ func (e *AgentEngine) streamThinkingToEventBus(
messages,
opts,
func(chunk *types.StreamResponse, fullContent string) {
if chunk.ResponseType == types.ResponseTypeToolCall && chunk.Data != nil {
toolCallID, _ := chunk.Data["tool_call_id"].(string)
toolName, _ := chunk.Data["tool_name"].(string)
if toolCallID != "" && toolName != "" && !pendingToolCalls[toolCallID] {
pendingToolCalls[toolCallID] = true
e.eventBus.Emit(ctx, event.Event{
ID: fmt.Sprintf("%s-tool-call-pending", toolCallID),
Type: event.EventAgentToolCall,
SessionID: sessionID,
Data: event.AgentToolCallData{
ToolCallID: toolCallID,
ToolName: toolName,
Iteration: iteration,
},
})
}
}
if chunk.Content != "" {
// logger.Debugf(ctx, "[Agent][Thinking][Iteration-%d] Emitting thought chunk: %d chars",
// iteration+1, len(chunk.Content))