fix: unable to get owner in chat and search (#17244)

### Summary

As title
This commit is contained in:
Haruko386
2026-07-22 21:27:08 +08:00
committed by GitHub
parent 48b63ab6b0
commit 1d165c7315
11 changed files with 245 additions and 50 deletions

View File

@@ -102,8 +102,10 @@ func (h *ChatHandler) ListChats(c *gin.Context) {
desc = descStr != "false"
}
ownerIDs := getOwnerIDs(c)
// List chats - default to valid status "1" (same as Python StatusEnum.VALID.value)
result, err := h.chatService.ListChats(userID, "1", keywords, page, pageSize, orderby, desc)
result, err := h.chatService.ListChats(userID, "1", keywords, page, pageSize, orderby, desc, ownerIDs)
if err != nil {
common.ResponseWithHttpCodeData(c, http.StatusInternalServerError, 500, nil, err.Error())
return

View File

@@ -124,7 +124,7 @@ func MCPListDatasets(ds *dataset.DatasetService, userID string, page, pageSize i
// MCPListChats wraps ChatService.ListChats for the MCP tool handler,
// converting the typed response into a generic []map[string]interface{}.
func MCPListChats(cs *service.ChatService, userID string, page, pageSize int, orderby string, desc bool) ([]map[string]interface{}, int64, error) {
resp, err := cs.ListChats(userID, "1", "", page, pageSize, orderby, desc)
resp, err := cs.ListChats(userID, "1", "", page, pageSize, orderby, desc, nil)
if err != nil {
return nil, 0, err
}

View File

@@ -51,7 +51,7 @@ func (h *SearchHandler) SetCompletionDependencies(streamLLM *service.ModelProvid
h.askService = askService
}
func getSearchOwnerIDs(c *gin.Context) []string {
func getOwnerIDs(c *gin.Context) []string {
values := c.QueryArray("owner_ids")
if len(values) == 0 {
values = c.QueryArray("owner_id")
@@ -114,7 +114,7 @@ func (h *SearchHandler) ListSearches(c *gin.Context) {
desc = descStr != "false"
}
ownerIDs := getSearchOwnerIDs(c)
ownerIDs := getOwnerIDs(c)
// Keep body parsing as a compatibility fallback for existing callers that
// send owner_ids in a GET body. Python reads owner_ids from the query.