Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func (w *Worker) AudioToText(ctx context.Context, req GenAudioToTextMultipartReq
return resp.JSON200, nil
}

func (w *Worker) LLM(ctx context.Context, req GenLLMJSONRequestBody) (interface{}, error) {
func (w *Worker) LLM(ctx context.Context, req GenLLMJSONRequestBody) (any, error) {
isStreaming := req.Stream != nil && *req.Stream
ctx, cancel := context.WithCancel(ctx)
c, err := w.borrowContainer(ctx, "llm", *req.Model)
Expand Down
26 changes: 13 additions & 13 deletions clog/clog.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,28 @@ func GetVal(ctx context.Context, key string) string {
return val
}

func Warningf(ctx context.Context, format string, args ...interface{}) {
func Warningf(ctx context.Context, format string, args ...any) {
if !glog.V(2) {
return
}
msg, _ := formatMessage(ctx, false, false, format, args...)
glog.WarningDepth(1, msg)
}

func Errorf(ctx context.Context, format string, args ...interface{}) {
func Errorf(ctx context.Context, format string, args ...any) {
if !glog.V(1) {
return
}
msg, _ := formatMessage(ctx, false, false, format, args...)
glog.ErrorDepth(1, msg)
}

func Infof(ctx context.Context, format string, args ...interface{}) {
func Infof(ctx context.Context, format string, args ...any) {
infof(ctx, false, false, format, args...)
}

// InfofErr if last argument is not nil it will be printed as " err=%q"
func InfofErr(ctx context.Context, format string, args ...interface{}) {
func InfofErr(ctx context.Context, format string, args ...any) {
infof(ctx, true, false, format, args...)
}

Expand All @@ -168,14 +168,14 @@ func V(level glog.Level) Verbose {

// Infof is equivalent to the global Infof function, guarded by the value of v.
// See the documentation of V for usage.
func (v Verbose) Infof(ctx context.Context, format string, args ...interface{}) {
func (v Verbose) Infof(ctx context.Context, format string, args ...any) {
if v {
infof(ctx, false, false, format, args...)
}
}

func (v Verbose) InfofErr(ctx context.Context, format string, args ...interface{}) {
var err interface{}
func (v Verbose) InfofErr(ctx context.Context, format string, args ...any) {
var err any
if len(args) > 0 {
err = args[len(args)-1]
}
Expand All @@ -184,7 +184,7 @@ func (v Verbose) InfofErr(ctx context.Context, format string, args ...interface{
}
}

func infof(ctx context.Context, lastErr bool, publicLog bool, format string, args ...interface{}) {
func infof(ctx context.Context, lastErr bool, publicLog bool, format string, args ...any) {
msg, isErr := formatMessage(ctx, lastErr, publicLog, format, args...)
if bool(glog.V(2)) && isErr {
glog.ErrorDepth(2, msg)
Expand All @@ -196,7 +196,7 @@ func infof(ctx context.Context, lastErr bool, publicLog bool, format string, arg
// Info logs a message with key-value pairs in a slog-like style.
// Example: Info(ctx, "hello", "key1", value1, "key2", value2)
// This will log: "hello key1=value1 key2=value2"
func Info(ctx context.Context, msg string, keyvals ...interface{}) {
func Info(ctx context.Context, msg string, keyvals ...any) {
if len(keyvals)%2 != 0 {
keyvals = append(keyvals[:len(keyvals)-1], "MISSING", keyvals[len(keyvals)-1])
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func Info(ctx context.Context, msg string, keyvals ...interface{}) {
}

// V returns a Verbose instance for conditional logging at the specified level
func (v Verbose) Info(ctx context.Context, msg string, keyvals ...interface{}) {
func (v Verbose) Info(ctx context.Context, msg string, keyvals ...any) {
if v {
Info(ctx, msg, keyvals...)
}
Expand Down Expand Up @@ -263,13 +263,13 @@ func messageFromContext(ctx context.Context, sb *strings.Builder) {
cmap.mu.RUnlock()
}

func formatMessage(ctx context.Context, lastErr bool, publicLog bool, format string, args ...interface{}) (string, bool) {
func formatMessage(ctx context.Context, lastErr bool, publicLog bool, format string, args ...any) (string, bool) {
var sb strings.Builder
if publicLog {
sb.WriteString(publicLogTag)
}
messageFromContext(ctx, &sb)
var err interface{}
var err any
if lastErr && len(args) > 0 {
err = args[len(args)-1]
args = args[:len(args)-1]
Expand All @@ -281,7 +281,7 @@ func formatMessage(ctx context.Context, lastErr bool, publicLog bool, format str
return sb.String(), err != nil
}

func PublicInfof(ctx context.Context, format string, args ...interface{}) {
func PublicInfof(ctx context.Context, format string, args ...any) {
publicCtx := context.Background()

publicCtx = PublicCloneCtx(ctx, publicCtx, publicLogKeys)
Expand Down
2 changes: 1 addition & 1 deletion eth/blockwatch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (rc *RPCClient) HeaderByHash(hash common.Hash) (*MiniHeader, error) {
return rc.callEth("eth_getBlockByHash", hash)
}

func (rc *RPCClient) callEth(method string, arg interface{}) (*MiniHeader, error) {
func (rc *RPCClient) callEth(method string, arg any) (*MiniHeader, error) {
ctx, cancel := context.WithTimeout(context.Background(), rc.requestTimeout)
defer cancel()

Expand Down
40 changes: 20 additions & 20 deletions monitor/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ type KafkaProducer struct {
}

type GatewayEvent struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type"`
Timestamp *string `json:"timestamp"`
Gateway *string `json:"gateway,omitempty"`
Data interface{} `json:"data"`
ID *string `json:"id,omitempty"`
Type *string `json:"type"`
Timestamp *string `json:"timestamp"`
Gateway *string `json:"gateway,omitempty"`
Data any `json:"data"`
}

type PipelineStatus struct {
Pipeline string `json:"pipeline"`
StartTime float64 `json:"start_time"`
LastParamsUpdateTime float64 `json:"last_params_update_time"`
LastParams interface{} `json:"last_params"`
LastParamsHash string `json:"last_params_hash"`
InputFPS float64 `json:"input_fps"`
OutputFPS float64 `json:"output_fps"`
LastInputTime float64 `json:"last_input_time"`
LastOutputTime float64 `json:"last_output_time"`
RestartCount int `json:"restart_count"`
LastRestartTime float64 `json:"last_restart_time"`
LastRestartLogs []string `json:"last_restart_logs"`
LastError *string `json:"last_error"`
StreamID *string `json:"stream_id"`
Pipeline string `json:"pipeline"`
StartTime float64 `json:"start_time"`
LastParamsUpdateTime float64 `json:"last_params_update_time"`
LastParams any `json:"last_params"`
LastParamsHash string `json:"last_params_hash"`
InputFPS float64 `json:"input_fps"`
OutputFPS float64 `json:"output_fps"`
LastInputTime float64 `json:"last_input_time"`
LastOutputTime float64 `json:"last_output_time"`
RestartCount int `json:"restart_count"`
LastRestartTime float64 `json:"last_restart_time"`
LastRestartLogs []string `json:"last_restart_logs"`
LastError *string `json:"last_error"`
StreamID *string `json:"stream_id"`
}

var kafkaProducer *KafkaProducer
Expand Down Expand Up @@ -149,7 +149,7 @@ func (p *KafkaProducer) sendBatch(eventsBatch []kafka.Message) {
}
}

func SendQueueEventAsync(eventType string, data interface{}) {
func SendQueueEventAsync(eventType string, data any) {
if kafkaProducer == nil {
return
}
Expand Down