chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)
This commit is contained in:
commit
9097ee699d
5769 files changed
+1446466
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
)
|
||||
|
||||
// Read the current caller's stored preference at engine creation, never the
|
||||
// shared agent owner's preference or a browser/client-supplied user ID.
|
||||
func (s *agentService) browserSearchInstructions(ctx context.Context) (string, error) {
|
||||
id, _ := types.UserIDFromContext(ctx)
|
||||
if s.userRepo == nil || id == "" {
|
||||
return types.DefaultBrowserSearchInstructions, nil
|
||||
}
|
||||
user, err := s.userRepo.GetUserByID(ctx, id)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("load browser search preferences: %w", err)
|
||||
}
|
||||
return user.Preferences.EffectiveBrowserSearchInstructions(), nil
|
||||
}
|
||||
Reference in new issue
Block a user