minecraft1024a
d12e384cc2
chore: perform widespread code cleanup and formatting
...
Perform a comprehensive code cleanup across multiple modules to improve code quality, consistency, and maintainability.
Key changes include:
- Removing numerous unused imports.
- Standardizing import order.
- Eliminating trailing whitespace and inconsistent newlines.
- Updating legacy type hints to modern syntax (e.g., `List` -> `list`).
- Making minor improvements for code robustness and style.
2025-11-19 23:58:47 +08:00
minecraft1024a
198976b68f
refactor(prompt): 将注意力和内容混淆统一为提示词扰动
...
本次提交重构了提示词修改逻辑,将之前独立的“注意力优化”和“内容混淆”功能合并为一个统一的概念:“提示词扰动”(Prompt Perturbation)。
主要变更包括:
- 在模型配置中引入新的统一选项:`enable_prompt_perturbation`, `perturbation_strength` 和 `enable_semantic_variants`。
- 将原 `AttentionOptimizer` 中的噪声注入和语义变体逻辑迁移到 `llm_models` 模块中,作为扰动策略的一部分。
- 简化 `attention_optimizer.py`,使其专注于提示词块重排 (`BlockShuffler`)。
- 更新 `_PromptProcessor` 以根据新的统一配置来协调不同的扰动技术。
此项更改为用户简化了配置,并通过集中化相关逻辑,提供了一个更清晰、更易于维护的实现。
BREAKING CHANGE: 内容混淆的相关配置已被替换。`enable_content_obfuscation` 和 `obfuscation_intensity` 配置项已移除。用户需更新配置以使用新的 `enable_prompt_perturbation` 和 `perturbation_strength`。
2025-11-19 23:58:46 +08:00
minecraft1024a
56e25c0b51
refactor(config): 移除废弃的数据库配置模块
...
旧的数据库配置模块 `src/common/database/config` 已被完全移除。该模块已被标记为废弃,其功能已统一整合到 `global_config` 中。
本次重构旨在:
- 简化代码库,消除冗余和过时的文件。
- 统一配置管理,提高可维护性。
此外,对 `AttentionOptimizer` 中的类变量添加了 `ClassVar` 类型注解,以增强代码的清晰度和类型安全性。
2025-11-19 23:37:44 +08:00
Windpicker-owo
c0e400f423
feat(attention): 添加注意力优化器以增强提示词多样性和防止注意力退化
...
refactor(prompt): 使用 asyncio.gather 替代 as_completed 以提升并发性能
refactor(config): 添加注意力优化配置选项
refactor(prompt_params): 增加注意力优化开关
2025-11-19 23:37:37 +08:00