mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
feat: 允许用户关闭数据上报
This commit is contained in:
parent
41b30238c3
commit
6c03fe678a
|
@ -362,8 +362,8 @@ rate_limit_strategy = "drop"
|
||||||
upgrade_dependencies = False
|
upgrade_dependencies = False
|
||||||
|
|
||||||
# 是否上报统计信息
|
# 是否上报统计信息
|
||||||
# 用于统计机器人的使用情况,不会收集任何用户信息
|
# 用于统计机器人的使用情况,数据不公开,不会收集任何敏感信息。
|
||||||
# 仅上报时间、字数使用量、绘图使用量,其他信息不会上报
|
# 仅实例识别UUID、上报时间、字数使用量、绘图使用量、插件使用情况、用户信息,其他信息不会上报
|
||||||
report_usage = True
|
report_usage = True
|
||||||
|
|
||||||
# 日志级别
|
# 日志级别
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .. import apigroup
|
from .. import apigroup
|
||||||
|
from ... import context
|
||||||
|
|
||||||
|
|
||||||
class V2MainDataAPI(apigroup.APIGroup):
|
class V2MainDataAPI(apigroup.APIGroup):
|
||||||
|
@ -9,6 +10,12 @@ class V2MainDataAPI(apigroup.APIGroup):
|
||||||
def __init__(self, prefix: str):
|
def __init__(self, prefix: str):
|
||||||
super().__init__(prefix+"/main")
|
super().__init__(prefix+"/main")
|
||||||
|
|
||||||
|
def do(self, *args, **kwargs):
|
||||||
|
config = context.get_config_manager().data
|
||||||
|
if not config['report_usage']:
|
||||||
|
return None
|
||||||
|
return super().do(*args, **kwargs)
|
||||||
|
|
||||||
def post_update_record(
|
def post_update_record(
|
||||||
self,
|
self,
|
||||||
spent_seconds: int,
|
spent_seconds: int,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .. import apigroup
|
from .. import apigroup
|
||||||
|
from ... import context
|
||||||
|
|
||||||
|
|
||||||
class V2PluginDataAPI(apigroup.APIGroup):
|
class V2PluginDataAPI(apigroup.APIGroup):
|
||||||
|
@ -9,6 +10,12 @@ class V2PluginDataAPI(apigroup.APIGroup):
|
||||||
def __init__(self, prefix: str):
|
def __init__(self, prefix: str):
|
||||||
super().__init__(prefix+"/plugin")
|
super().__init__(prefix+"/plugin")
|
||||||
|
|
||||||
|
def do(self, *args, **kwargs):
|
||||||
|
config = context.get_config_manager().data
|
||||||
|
if not config['report_usage']:
|
||||||
|
return None
|
||||||
|
return super().do(*args, **kwargs)
|
||||||
|
|
||||||
def post_install_record(
|
def post_install_record(
|
||||||
self,
|
self,
|
||||||
plugin: dict
|
plugin: dict
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .. import apigroup
|
from .. import apigroup
|
||||||
|
from ... import context
|
||||||
|
|
||||||
|
|
||||||
class V2UsageDataAPI(apigroup.APIGroup):
|
class V2UsageDataAPI(apigroup.APIGroup):
|
||||||
|
@ -8,6 +9,12 @@ class V2UsageDataAPI(apigroup.APIGroup):
|
||||||
|
|
||||||
def __init__(self, prefix: str):
|
def __init__(self, prefix: str):
|
||||||
super().__init__(prefix+"/usage")
|
super().__init__(prefix+"/usage")
|
||||||
|
|
||||||
|
def do(self, *args, **kwargs):
|
||||||
|
config = context.get_config_manager().data
|
||||||
|
if not config['report_usage']:
|
||||||
|
return None
|
||||||
|
return super().do(*args, **kwargs)
|
||||||
|
|
||||||
def post_query_record(
|
def post_query_record(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user