fix(logger): nil pointer error + log debug level clean
This commit is contained in:
@ -160,8 +160,6 @@ func (client AgentClient) Request(req *AgentRequestBody) (AgentResponse, error)
|
|||||||
return AgentResponse{}, errors.New("Unsupported. We currently only accept 1 choice from AI.")
|
return AgentResponse{}, errors.New("Unsupported. We currently only accept 1 choice from AI.")
|
||||||
}
|
}
|
||||||
|
|
||||||
client.Log.SetLevel(log.DebugLevel)
|
|
||||||
|
|
||||||
msg := agentResponse.Choices[0].Message
|
msg := agentResponse.Choices[0].Message
|
||||||
|
|
||||||
if len(msg.Content) > 0 {
|
if len(msg.Content) > 0 {
|
||||||
@ -229,7 +227,6 @@ func (client *AgentClient) Process(info ToolHandlerInfo, req *AgentRequestBody)
|
|||||||
client.Reply = toolCall.Function.Arguments
|
client.Reply = toolCall.Function.Arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
client.Log.SetLevel(log.DebugLevel)
|
|
||||||
client.Log.Debugf("Response: %s", toolResponse.Content)
|
client.Log.Debugf("Response: %s", toolResponse.Content)
|
||||||
|
|
||||||
req.Chat.AddToolResponse(toolResponse)
|
req.Chat.AddToolResponse(toolResponse)
|
||||||
|
@ -116,7 +116,7 @@ func NewEventAgent(log *log.Logger, eventsModel models.EventModel, locationModel
|
|||||||
EndToolCall: "finish",
|
EndToolCall: "finish",
|
||||||
})
|
})
|
||||||
|
|
||||||
locationAgent := NewLocationAgent(log.With("Locations 📍"), locationModel)
|
locationAgent := NewLocationAgent(log.WithPrefix("Events 📅 > Locations 📍"), locationModel)
|
||||||
locationQuery := "Can you get me the ID of the location present in this image?"
|
locationQuery := "Can you get me the ID of the location present in this image?"
|
||||||
locationAgent.Options.Query = &locationQuery
|
locationAgent.Options.Query = &locationQuery
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ func (agent NoteAgent) GetNotes(userId uuid.UUID, imageId uuid.UUID, imageName s
|
|||||||
func NewNoteAgent(log *log.Logger, noteModel models.NoteModel) NoteAgent {
|
func NewNoteAgent(log *log.Logger, noteModel models.NoteModel) NoteAgent {
|
||||||
client := client.CreateAgentClient(client.CreateAgentClientOptions{
|
client := client.CreateAgentClient(client.CreateAgentClientOptions{
|
||||||
SystemPrompt: noteAgentPrompt,
|
SystemPrompt: noteAgentPrompt,
|
||||||
|
Log: log,
|
||||||
})
|
})
|
||||||
|
|
||||||
agent := NoteAgent{
|
agent := NoteAgent{
|
||||||
|
@ -14,11 +14,15 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func createLogger(prefix string) *log.Logger {
|
func createLogger(prefix string) *log.Logger {
|
||||||
return log.NewWithOptions(os.Stdout, log.Options{
|
logger := log.NewWithOptions(os.Stdout, log.Options{
|
||||||
ReportTimestamp: true,
|
ReportTimestamp: true,
|
||||||
TimeFormat: time.Kitchen,
|
TimeFormat: time.Kitchen,
|
||||||
Prefix: prefix,
|
Prefix: prefix,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
logger.SetLevel(log.DebugLevel)
|
||||||
|
|
||||||
|
return logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func ListenNewImageEvents(db *sql.DB, eventManager *EventManager) {
|
func ListenNewImageEvents(db *sql.DB, eventManager *EventManager) {
|
||||||
|
Reference in New Issue
Block a user