usecase

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package usecase 는 AI 어시스턴트의 에이전트 루프다 — 대화를 모델에 넘기고, 모델이 고른 도구를 질문한 사용자의 권한으로 실행해 결과를 되돌려 주며 답을 만든다.

Index

Constants

View Source
const DefaultDeadline = 55 * time.Second

DefaultDeadline 은 질문 하나에 쓰는 시간이다. 웹 앞단 프록시(nginx 기본 60초)보다 먼저 끝내야 화면이 504 대신 시간 초과 안내를 받는다.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	// contains filtered or unexported fields
}

Chat 은 에이전트 루프다. 조직이 관리 화면에서 등록한 설정(공급자 · 모델 · 키)으로 모델을 고른다.

func NewChat

func NewChat(settings port.SettingsRepository, models port.LLMFactory, tools port.ToolSessionOpener) *Chat

func (*Chat) Execute

func (uc *Chat) Execute(ctx context.Context, in ChatInput) (*ChatOutput, error)

Execute 는 질문에 답한다. 도구 라운드는 domain.MaxToolRounds 까지 — 넘기면 도구 없이 한 번 더 물어 그때까지의 결과로 마무리하게 한다.

func (*Chat) Status

func (uc *Chat) Status(ctx context.Context, orgID string) (Status, error)

Status 는 조직의 어시스턴트가 켜져 있는지다.

type ChatInput

type ChatInput struct {
	OrgID       string
	Turns       []domain.Turn
	Page        domain.PageContext
	Credentials port.Credentials
}

ChatInput 은 질문 하나다. Turns 는 화면이 들고 있는 대화 전체(마지막이 이번 질문)다. 모델은 OrgID 의 저장된 설정으로 고른다.

type ChatOutput

type ChatOutput struct {
	Reply string
	Tools []domain.ToolTrace
}

ChatOutput 은 답과 그 답을 위해 쓴 도구다.

type SettingsService

type SettingsService struct {
	// contains filtered or unexported fields
}

SettingsService 는 조직의 어시스턴트 설정 — 공급자 · 모델 · 키 — 을 관리한다.

func NewSettingsService

func NewSettingsService(repo port.SettingsRepository, models port.LLMFactory) *SettingsService

func (*SettingsService) Delete

func (s *SettingsService) Delete(ctx context.Context, orgID string) error

func (*SettingsService) Get

func (s *SettingsService) Get(ctx context.Context, orgID string) (SettingsView, error)

func (*SettingsService) Test

Test 는 보낸 설정(키를 안 보내면 저장된 키)으로 모델에 한 번 물어 본다. 아무것도 저장하지 않는다. 설정이 맞지 않으면 오류, 모델이 실패하면 OK=false 와 사유다 — 사유에서 키는 가린다.

func (*SettingsService) Update

func (s *SettingsService) Update(ctx context.Context, orgID, actor string, in UpdateSettings) (SettingsView, error)

Update 는 설정을 검증해 저장한다.

type SettingsView

type SettingsView struct {
	Enabled          bool
	Provider         string
	BaseURL          string
	Model            string
	HasKey           bool
	KeyHint          string
	KeyUnreadable    bool
	EffectiveBaseURL string
	EffectiveModel   string
	UpdatedAt        *time.Time
	UpdatedBy        string
	Providers        []domain.Provider
}

SettingsView 는 관리 화면이 보는 설정이다 — 키 원문은 없다.

type Status

type Status struct {
	Enabled  bool
	Provider string
	Model    string
}

Status 는 화면이 버튼을 그릴지 정하는 정보다.

type TestResult

type TestResult struct {
	OK        bool
	Model     string
	Error     string
	LatencyMs int64
}

TestResult 는 연결 테스트 결과다.

type UpdateSettings

type UpdateSettings struct {
	Enabled  bool
	Provider string
	BaseURL  string
	Model    string
	APIKey   *string
}

UpdateSettings 는 관리 화면이 보낸 설정이다. APIKey 가 nil 이면 저장된 키를 그대로 쓰고(공급자와 주소가 같을 때만), 빈 문자열이면 지운다.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL