2121from common .exception .app_exception import AppApiException
2222from common .utils .common import get_file_content
2323from maxkb .conf import PROJECT_DIR
24+ from maxkb .settings import edition
2425
2526
2627class ApplicationStatsSerializer (serializers .Serializer ):
@@ -133,7 +134,9 @@ def get_token_usage_statistics(self, with_valid=True):
133134 'application_chat_record.create_time__lte' : end_time }
134135 )},
135136 select_string = get_file_content (
136- os .path .join (PROJECT_DIR , "apps" , "application" , 'sql' , 'get_token_usage.sql' )))
137+ os .path .join (PROJECT_DIR , "apps" , "application" , 'sql' ,
138+ ('get_token_usage_ee.sql' if ['PE' , 'EE' ].__contains__ (
139+ edition ) else 'get_token_usage.sql' ))))
137140 return get_token_usage
138141
139142 def get_top_questions_statistics (self , with_valid = True ):
@@ -150,5 +153,6 @@ def get_top_questions_statistics(self, with_valid=True):
150153 'application_chat_record.create_time__lte' : end_time }
151154 )},
152155 select_string = get_file_content (
153- os .path .join (PROJECT_DIR , "apps" , "application" , 'sql' , 'top_questions.sql' )))
154- return get_top_questions
156+ os .path .join (PROJECT_DIR , "apps" , "application" , 'sql' , (
157+ 'top_questions_ee.sql' if ['PE' , 'EE' ].__contains__ (edition ) else 'top_questions.sql' ))))
158+ return get_top_questions
0 commit comments