package service

import (
    "context"
    "github.com/cloudwego/eino/compose"
    "github.com/cloudwego/eino/schema"
    "ai_scheduler/internal/config"
    "ai_scheduler/internal/domain/llm/pipeline"
)

type ChatService struct{ run compose.Runnable[[]*schema.Message, *schema.Message] }

func NewChatService(ctx context.Context, cfg *config.Config) (*ChatService, error) {
    r, err := pipeline.BuildChat(ctx, cfg)
    if err != nil { return nil, err }
    return &ChatService{run: r}, nil
}

func (s *ChatService) Invoke(ctx context.Context, msgs []*schema.Message) (*schema.Message, error) {
    return s.run.Invoke(ctx, msgs)
}

