feat(thinkingControl): implement thinking mode configuration in model editor
- Added a new thinking mode control field in the ModelEditorDialog, allowing users to specify how the agent's thinking mode is formatted for API requests. - Introduced localization strings for thinking mode labels and descriptions in English, Korean, Russian, and Chinese, enhancing user experience across multiple languages. - Updated the model form data structure to include thinking control settings, ensuring proper handling during model edits and saves. - Implemented utility functions for resolving and defaulting thinking control values based on provider and model, improving backend integration. - Added tests for the new thinking control functionality to ensure reliability and correctness in handling user configurations.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
)
|
||||
|
||||
// logUsage emits the standard "[LLM Usage]" line shared by every Chat
|
||||
// implementation. It is a no-op when usage is nil so callers can pass through
|
||||
// optional usage blocks without guarding at each call site.
|
||||
func logUsage(ctx context.Context, model string, u *types.TokenUsage) {
|
||||
if u == nil {
|
||||
return
|
||||
}
|
||||
logger.Infof(ctx,
|
||||
"[LLM Usage] model=%s, prompt_tokens=%d, completion_tokens=%d, total_tokens=%d, cached_tokens=%d",
|
||||
model, u.PromptTokens, u.CompletionTokens, u.TotalTokens, u.CachedTokens)
|
||||
}
|
||||
Reference in New Issue
Block a user