mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
docs(agents): 添加AI代理行为准则文档
- 定义了环境能力清单和工具选择规则 - 规定了XML文档注释、内联注释和架构级注释要求 - 明确了代码风格包括命名规范、格式化和C#约定 - 设立了测试覆盖范围、组织结构和验证命令标准 - 制定了安全输入验证、依赖管理和权限控制规则 - 确立了文档更新、任务跟踪和审查完成标准 - 更新了浮点数比较算法中的容差计算方式 - 优化了数值精度验证逻辑以避免十进制步进误差
This commit is contained in:
parent
f9f608ad64
commit
ccb6b5ad42
@ -104,6 +104,10 @@ All generated or modified code MUST include clear and meaningful comments where
|
||||
- Keep `using` directives at the top of the file and sort them consistently.
|
||||
- Separate logical blocks with blank lines when it improves readability.
|
||||
- Prefer one primary type per file unless the surrounding project already uses a different local pattern.
|
||||
- Unless there is a clear and documented reason to keep a file large, keep a single source file under roughly 800-1000
|
||||
lines.
|
||||
- If a file grows beyond that range, contributors MUST stop and check whether responsibilities should be split before
|
||||
continuing; treating oversized files as the default is considered a design smell.
|
||||
- Keep line length readable. Around 120 characters is the preferred upper bound.
|
||||
|
||||
### C# Conventions
|
||||
|
||||
@ -1745,8 +1745,9 @@ internal static class YamlConfigSchemaValidator
|
||||
|
||||
/// <summary>
|
||||
/// 判断数值是否满足 <c>multipleOf</c>。
|
||||
/// 双精度浮点比较会保留一个与商值量级相关的微小容差,
|
||||
/// 以避免运行时与 JS 工具侧在 0.1 / 0.01 这类十进制步进上出现伪失败。
|
||||
/// 双精度浮点比较会保留一个与步进量级相关的微小容差,
|
||||
/// 以避免运行时与 JS 工具侧在 0.1 / 0.01 这类十进制步进上出现伪失败,
|
||||
/// 同时避免值越大就无限放宽合法余数范围。
|
||||
/// </summary>
|
||||
/// <param name="value">当前值。</param>
|
||||
/// <param name="divisor">步进约束。</param>
|
||||
@ -1755,8 +1756,8 @@ internal static class YamlConfigSchemaValidator
|
||||
{
|
||||
var quotient = value / divisor;
|
||||
var nearestInteger = Math.Round(quotient);
|
||||
var tolerance = 1e-9 * Math.Max(1d, Math.Abs(quotient));
|
||||
return Math.Abs(quotient - nearestInteger) <= tolerance;
|
||||
var tolerance = 1e-9 * Math.Max(1d, Math.Abs(divisor));
|
||||
return Math.Abs(value - (nearestInteger * divisor)) <= tolerance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user