Files
zeekay c48e457ee7 the SSE wrappers hold the writer they write to
AnthropicWriter and RefinedWriter embedded the response object and reached
through it — w.ResponseWriter.Write, then a type assertion to find a Flusher.
They hold a *bufio.Writer now, which is what SendStreamWriter hands a streaming
handler: writing and flushing are both just calls on it.

responseError and object.NewRecord read the context directly. NewRecord stops
marshalling the whole response and parsing it back to recover two fields — the
status code it already has says the same thing, and that map went with the render
step. AppendWebConfigCookie takes a function that sets a cookie, so util no
longer needs a web type to write one.

909 compile errors down to 35, of which 8 are the dev-bridge websocket.
2026-08-16 22:52:00 -07:00

35 lines
1015 B
Go

// Copyright 2023-2025 Hanzo AI Inc. All Rights Reserved.
// Portions Copyright 2025 The OpenAgent Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package util
import (
"encoding/json"
"github.com/hanzoai/ai/conf"
)
func AppendWebConfigCookie(setCookie func(name, value string)) error {
webConfig := conf.GetWebConfig()
jsonWebConfig, err := json.Marshal(webConfig)
if err != nil {
return err
}
setCookie("jsonWebConfig", string(jsonWebConfig))
return nil
}