All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add auth-svc /validate endpoint for token checking Add chat-svc with auth client and Redis task queue Add worker-svc chat handler for task processing Co-Authored-By: Claude Code <claude@anthropic.com>
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package handlers
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.threesix.ai/jordan/sp4-debug-1770477266/pkg/logging"
|
|
"git.threesix.ai/jordan/sp4-debug-1770477266/pkg/queue"
|
|
)
|
|
|
|
// JobTypeChatProcess is the job type for chat message processing.
|
|
const JobTypeChatProcess = "chat.process"
|
|
|
|
// NewChatProcessHandler creates a handler for chat.process jobs.
|
|
func NewChatProcessHandler(logger *logging.Logger) queue.Handler {
|
|
log := logger.WithComponent("chat-handler")
|
|
|
|
return func(ctx context.Context, job *queue.Job) error {
|
|
userID, _ := job.Payload["user_id"].(string)
|
|
message, _ := job.Payload["message"].(string)
|
|
|
|
if userID == "" {
|
|
return fmt.Errorf("missing user_id in payload")
|
|
}
|
|
if message == "" {
|
|
return fmt.Errorf("missing message in payload")
|
|
}
|
|
|
|
log.Info("processing chat message",
|
|
"job_id", job.ID,
|
|
"user_id", userID,
|
|
"message_len", len(message),
|
|
)
|
|
|
|
// TODO: Implement actual chat processing logic (e.g., AI response, storage, notifications)
|
|
|
|
log.Info("chat message processed",
|
|
"job_id", job.ID,
|
|
"user_id", userID,
|
|
)
|
|
return nil
|
|
}
|
|
}
|