mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 15:26:03 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
092bb0a1e2 | ||
|
|
2c3399e237 | ||
|
|
835275b47f | ||
|
|
7b060ce3f9 |
@@ -11,7 +11,7 @@
|
|||||||
<a href="https://hub.docker.com/repository/docker/rockchin/qchatgpt">
|
<a href="https://hub.docker.com/repository/docker/rockchin/qchatgpt">
|
||||||
<img src="https://img.shields.io/docker/pulls/rockchin/qchatgpt?color=blue" alt="docker pull">
|
<img src="https://img.shields.io/docker/pulls/rockchin/qchatgpt?color=blue" alt="docker pull">
|
||||||
</a>
|
</a>
|
||||||

|

|
||||||
<a href="https://codecov.io/gh/RockChinQ/QChatGPT" >
|
<a href="https://codecov.io/gh/RockChinQ/QChatGPT" >
|
||||||
<img src="https://codecov.io/gh/RockChinQ/QChatGPT/graph/badge.svg?token=pjxYIL2kbC"/>
|
<img src="https://codecov.io/gh/RockChinQ/QChatGPT/graph/badge.svg?token=pjxYIL2kbC"/>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class SensitiveWordMigration(migration.Migration):
|
|||||||
async def need_migrate(self) -> bool:
|
async def need_migrate(self) -> bool:
|
||||||
"""判断当前环境是否需要运行此迁移
|
"""判断当前环境是否需要运行此迁移
|
||||||
"""
|
"""
|
||||||
return os.path.exists("data/config/sensitive-words.json")
|
return os.path.exists("data/config/sensitive-words.json") and not os.path.exists("data/metadata/sensitive-words.json")
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
"""执行迁移
|
"""执行迁移
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class Conversation(pydantic.BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class Session(pydantic.BaseModel):
|
class Session(pydantic.BaseModel):
|
||||||
"""会话,一个 Session 对应一个 {launcher_type}_{launcher_id}"""
|
"""会话,一个 Session 对应一个 {launcher_type.value}_{launcher_id}"""
|
||||||
launcher_type: LauncherTypes
|
launcher_type: LauncherTypes
|
||||||
|
|
||||||
launcher_id: int
|
launcher_id: int
|
||||||
|
|||||||
@@ -25,22 +25,24 @@ class BanSessionCheckStage(stage.PipelineStage):
|
|||||||
|
|
||||||
sess_list = self.ap.pipeline_cfg.data['access-control'][mode]
|
sess_list = self.ap.pipeline_cfg.data['access-control'][mode]
|
||||||
|
|
||||||
if (query.launcher_type == 'group' and 'group_*' in sess_list) \
|
if (query.launcher_type.value == 'group' and 'group_*' in sess_list) \
|
||||||
or (query.launcher_type == 'person' and 'person_*' in sess_list):
|
or (query.launcher_type.value == 'person' and 'person_*' in sess_list):
|
||||||
found = True
|
found = True
|
||||||
else:
|
else:
|
||||||
for sess in sess_list:
|
for sess in sess_list:
|
||||||
if sess == f"{query.launcher_type}_{query.launcher_id}":
|
if sess == f"{query.launcher_type.value}_{query.launcher_id}":
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
ctn = False
|
||||||
|
|
||||||
result = False
|
if mode == 'whitelist':
|
||||||
|
ctn = found
|
||||||
if mode == 'blacklist':
|
else:
|
||||||
result = found
|
ctn = not found
|
||||||
|
|
||||||
return entities.StageProcessResult(
|
return entities.StageProcessResult(
|
||||||
result_type=entities.ResultType.CONTINUE if not result else entities.ResultType.INTERRUPT,
|
result_type=entities.ResultType.CONTINUE if ctn else entities.ResultType.INTERRUPT,
|
||||||
new_query=query,
|
new_query=query,
|
||||||
debug_notice=f'根据访问控制忽略消息: {query.launcher_type}_{query.launcher_id}' if result else ''
|
console_notice=f'根据访问控制忽略消息: {query.launcher_type.value}_{query.launcher_id}' if not ctn else ''
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class RateLimit(stage.PipelineStage):
|
|||||||
)
|
)
|
||||||
elif stage_inst_name == "ReleaseRateLimitOccupancy":
|
elif stage_inst_name == "ReleaseRateLimitOccupancy":
|
||||||
await self.algo.release_access(
|
await self.algo.release_access(
|
||||||
query.launcher_type,
|
query.launcher_type.value,
|
||||||
query.launcher_id,
|
query.launcher_id,
|
||||||
)
|
)
|
||||||
return entities.StageProcessResult(
|
return entities.StageProcessResult(
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
semantic_version = "v3.1.0"
|
semantic_version = "v3.1.0.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user