在既有 kbbinding(迁移 000081)上补齐任务要求,不另建表、不另起路由: - 测试连接区分 401/403(密钥无效 / 无权限)与不可达、成功四态; - 视图回显密钥尾 4 位(服务端不存、不回读明文); - key_action=clear 作为独立动作,清除后解析失败关闭、不回落文件旧 Key; - 内外库留空 = 取消绑定,回报回退来源(测试侧部署默认库 / 生产侧同 ID 语义); - 生产绑定回报在飞执行的冻结/仍可改指向条数,已冻结目标不被改写; - 新增 WEKNORA_ALLOW_PRIVATE_HTTP:客户端/探活/连接页共用 HTTPAllowed, 只放行 RFC1918/回环/链路本地 http,生产 18093 同网段反代因此可用。
This commit is contained in:
+10
-8
@@ -52,9 +52,10 @@ func newWeKnoraReadinessResolver(
|
||||
// weKnoraLister 让「系统设置」的知识库下拉与保存校验同样跟随当前端点/凭据,
|
||||
// 而不是复用启动时的客户端(否则改端点后选项仍来自旧实例)。
|
||||
type weKnoraLister struct {
|
||||
resolve func(context.Context) (baseURL, apiKey string, err error)
|
||||
timeout time.Duration
|
||||
allowDockerHTTP bool
|
||||
resolve func(context.Context) (baseURL, apiKey string, err error)
|
||||
timeout time.Duration
|
||||
allowDockerHTTP bool
|
||||
allowPrivateHTTP bool
|
||||
}
|
||||
|
||||
func (lister *weKnoraLister) ListKnowledgeBases(ctx context.Context) ([]weknora.KnowledgeBase, error) {
|
||||
@@ -76,7 +77,7 @@ func (lister *weKnoraLister) ListKnowledgeBases(ctx context.Context) ([]weknora.
|
||||
if timeout <= 0 || timeout > 10*time.Second {
|
||||
timeout = 10 * time.Second
|
||||
}
|
||||
client, err := weknora.NewClient(weknora.ClientConfig{BaseURL: baseURL, APIKey: apiKey, Timeout: timeout, AllowDockerHTTP: lister.allowDockerHTTP})
|
||||
client, err := weknora.NewClient(weknora.ClientConfig{BaseURL: baseURL, APIKey: apiKey, Timeout: timeout, AllowDockerHTTP: lister.allowDockerHTTP, AllowPrivateHTTP: lister.allowPrivateHTTP})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -87,9 +88,10 @@ func (lister *weKnoraLister) ListKnowledgeBases(ctx context.Context) ([]weknora.
|
||||
// (加密密钥),而不是另一条文件凭据。显式传入的地址必须与已保存连接一致,
|
||||
// 防止把生产密钥发往另一个地址。
|
||||
type productionKnowledgeBaseLister struct {
|
||||
bindings *kbbinding.Store
|
||||
timeout time.Duration
|
||||
allowDockerHTTP bool
|
||||
bindings *kbbinding.Store
|
||||
timeout time.Duration
|
||||
allowDockerHTTP bool
|
||||
allowPrivateHTTP bool
|
||||
}
|
||||
|
||||
func (lister *productionKnowledgeBaseLister) ListProductionKnowledgeBases(ctx context.Context, baseURL string) ([]weknora.KnowledgeBase, error) {
|
||||
@@ -107,7 +109,7 @@ func (lister *productionKnowledgeBaseLister) ListProductionKnowledgeBases(ctx co
|
||||
if timeout <= 0 || timeout > 10*time.Second {
|
||||
timeout = 10 * time.Second
|
||||
}
|
||||
client, err := weknora.NewClient(weknora.ClientConfig{BaseURL: target.BaseURL, APIKey: target.APIKey, Timeout: timeout, AllowDockerHTTP: lister.allowDockerHTTP})
|
||||
client, err := weknora.NewClient(weknora.ClientConfig{BaseURL: target.BaseURL, APIKey: target.APIKey, Timeout: timeout, AllowDockerHTTP: lister.allowDockerHTTP, AllowPrivateHTTP: lister.allowPrivateHTTP})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user