mirror of
				https://github.com/infiniflow/ragflow.git
				synced 2025-11-03 19:29:43 +00:00 
			
		
		
		
	Fix index not found for new user. (#4597)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
		
							parent
							
								
									15f9406e7b
								
							
						
					
					
						commit
						c4b9e903c8
					
				@ -14,6 +14,7 @@
 | 
			
		||||
#  limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
import json
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
from flask import request
 | 
			
		||||
from flask_login import login_required, current_user
 | 
			
		||||
@ -286,13 +287,18 @@ def knowledge_graph(kb_id):
 | 
			
		||||
            message='No authorization.',
 | 
			
		||||
            code=settings.RetCode.AUTHENTICATION_ERROR
 | 
			
		||||
        )
 | 
			
		||||
    e, kb = KnowledgebaseService.get_by_id(kb_id)
 | 
			
		||||
    _, kb = KnowledgebaseService.get_by_id(kb_id)
 | 
			
		||||
    req = {
 | 
			
		||||
        "kb_id": [kb_id],
 | 
			
		||||
        "knowledge_graph_kwd": ["graph"]
 | 
			
		||||
    }
 | 
			
		||||
    sres = settings.retrievaler.search(req, search.index_name(kb.tenant_id), [kb_id])
 | 
			
		||||
    obj = {"graph": {}, "mind_map": {}}
 | 
			
		||||
    try:
 | 
			
		||||
        sres = settings.retrievaler.search(req, search.index_name(kb.tenant_id), [kb_id])
 | 
			
		||||
    except Exception as e:
 | 
			
		||||
        logging.exception(e)
 | 
			
		||||
        return get_json_result(data=obj)
 | 
			
		||||
 | 
			
		||||
    for id in sres.ids[:1]:
 | 
			
		||||
        ty = sres.field[id]["knowledge_graph_kwd"]
 | 
			
		||||
        try:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user