mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-24 17:36:47 +08:00
fix: unable to get owner in chat and search (#17244)
### Summary As title
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user