mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-10-12 02:37:18 +02:00
Add files via upload
This commit is contained in:
2 files changed
+31
-10
No files matched your search
@@ -811,8 +811,8 @@ func (b *Builder) callAIForChainGeneration(ctx context.Context, prompt string) (
|
|||||||
"content": prompt,
|
"content": prompt,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"temperature": 0.3,
|
"temperature": 0.3,
|
||||||
"max_tokens": 8000,
|
"max_completion_tokens": 80000,
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiResponse struct {
|
var apiResponse struct {
|
||||||
|
|||||||
@@ -275,11 +275,25 @@ type MultiAgentAPIUpdate struct {
|
|||||||
|
|
||||||
// RobotsConfig 机器人配置(企业微信、钉钉、飞书等)
|
// RobotsConfig 机器人配置(企业微信、钉钉、飞书等)
|
||||||
type RobotsConfig struct {
|
type RobotsConfig struct {
|
||||||
|
Session RobotSessionConfig `yaml:"session,omitempty" json:"session,omitempty"` // 机器人会话隔离策略
|
||||||
Wecom RobotWecomConfig `yaml:"wecom,omitempty" json:"wecom,omitempty"` // 企业微信
|
Wecom RobotWecomConfig `yaml:"wecom,omitempty" json:"wecom,omitempty"` // 企业微信
|
||||||
Dingtalk RobotDingtalkConfig `yaml:"dingtalk,omitempty" json:"dingtalk,omitempty"` // 钉钉
|
Dingtalk RobotDingtalkConfig `yaml:"dingtalk,omitempty" json:"dingtalk,omitempty"` // 钉钉
|
||||||
Lark RobotLarkConfig `yaml:"lark,omitempty" json:"lark,omitempty"` // 飞书
|
Lark RobotLarkConfig `yaml:"lark,omitempty" json:"lark,omitempty"` // 飞书
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RobotSessionConfig 机器人会话隔离策略
|
||||||
|
type RobotSessionConfig struct {
|
||||||
|
StrictUserIdentity *bool `yaml:"strict_user_identity,omitempty" json:"strict_user_identity,omitempty"` // true 时只允许真实用户标识,不允许会话/群 ID 兜底
|
||||||
|
}
|
||||||
|
|
||||||
|
// StrictUserIdentityEnabled 返回是否启用严格用户身份模式;未配置时默认 true。
|
||||||
|
func (c RobotSessionConfig) StrictUserIdentityEnabled() bool {
|
||||||
|
if c.StrictUserIdentity == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return *c.StrictUserIdentity
|
||||||
|
}
|
||||||
|
|
||||||
// RobotWecomConfig 企业微信机器人配置
|
// RobotWecomConfig 企业微信机器人配置
|
||||||
type RobotWecomConfig struct {
|
type RobotWecomConfig struct {
|
||||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||||
@@ -292,17 +306,19 @@ type RobotWecomConfig struct {
|
|||||||
|
|
||||||
// RobotDingtalkConfig 钉钉机器人配置
|
// RobotDingtalkConfig 钉钉机器人配置
|
||||||
type RobotDingtalkConfig struct {
|
type RobotDingtalkConfig struct {
|
||||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||||
ClientID string `yaml:"client_id" json:"client_id"` // 应用 Key (AppKey)
|
ClientID string `yaml:"client_id" json:"client_id"` // 应用 Key (AppKey)
|
||||||
ClientSecret string `yaml:"client_secret" json:"client_secret"` // 应用 Secret
|
ClientSecret string `yaml:"client_secret" json:"client_secret"` // 应用 Secret
|
||||||
|
AllowConversationIDFallback bool `yaml:"allow_conversation_id_fallback" json:"allow_conversation_id_fallback"` // sender_id 缺失时是否允许回退到会话 ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// RobotLarkConfig 飞书机器人配置
|
// RobotLarkConfig 飞书机器人配置
|
||||||
type RobotLarkConfig struct {
|
type RobotLarkConfig struct {
|
||||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||||
AppID string `yaml:"app_id" json:"app_id"` // 应用 App ID
|
AppID string `yaml:"app_id" json:"app_id"` // 应用 App ID
|
||||||
AppSecret string `yaml:"app_secret" json:"app_secret"` // 应用 App Secret
|
AppSecret string `yaml:"app_secret" json:"app_secret"` // 应用 App Secret
|
||||||
VerifyToken string `yaml:"verify_token" json:"verify_token"` // 事件订阅 Verification Token(可选)
|
VerifyToken string `yaml:"verify_token" json:"verify_token"` // 事件订阅 Verification Token(可选)
|
||||||
|
AllowChatIDFallback bool `yaml:"allow_chat_id_fallback" json:"allow_chat_id_fallback"` // 用户 ID 缺失时是否允许回退到 chat_id
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
@@ -465,7 +481,6 @@ func Load(path string) (*Config, error) {
|
|||||||
if cfg.Auth.SessionDurationHours <= 0 {
|
if cfg.Auth.SessionDurationHours <= 0 {
|
||||||
cfg.Auth.SessionDurationHours = 12
|
cfg.Auth.SessionDurationHours = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.TrimSpace(cfg.Auth.Password) == "" {
|
if strings.TrimSpace(cfg.Auth.Password) == "" {
|
||||||
password, err := generateStrongPassword(24)
|
password, err := generateStrongPassword(24)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -934,6 +949,7 @@ func LoadRoleFromFile(path string) (*RoleConfig, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Default() *Config {
|
func Default() *Config {
|
||||||
|
strictRobotIdentity := true
|
||||||
return &Config{
|
return &Config{
|
||||||
Server: ServerConfig{
|
Server: ServerConfig{
|
||||||
Host: "0.0.0.0",
|
Host: "0.0.0.0",
|
||||||
@@ -968,6 +984,11 @@ func Default() *Config {
|
|||||||
Auth: AuthConfig{
|
Auth: AuthConfig{
|
||||||
SessionDurationHours: 12,
|
SessionDurationHours: 12,
|
||||||
},
|
},
|
||||||
|
Robots: RobotsConfig{
|
||||||
|
Session: RobotSessionConfig{
|
||||||
|
StrictUserIdentity: &strictRobotIdentity,
|
||||||
|
},
|
||||||
|
},
|
||||||
Knowledge: KnowledgeConfig{
|
Knowledge: KnowledgeConfig{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
BasePath: "knowledge_base",
|
BasePath: "knowledge_base",
|
||||||
|
|||||||
Reference in new issue
Block a user