convert

package
v0.0.0-...-9e5e0b2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 36 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ActionConvert      = "convert"
	ActionMerge        = "merge"
	ActionSplit        = "split"
	ActionTrim         = "trim"
	ActionExtractAudio = "extract_audio"
	ActionExtractFrame = "extract_frames"
	ActionTTS          = "tts"
	ActionASR          = "asr"
)

Variables

This section is empty.

Functions

func CardData

func CardData(task *ConvertTask) map[string]interface{}

func NormalizeDocumentReadFormat

func NormalizeDocumentReadFormat(raw string) string

NormalizeDocumentReadFormat normalizes office-style document extensions into the extraction families understood by the reader.

func SupportsDocumentReadFormat

func SupportsDocumentReadFormat(raw string) bool

SupportsDocumentReadFormat reports whether the reader can attempt a readable extraction for the provided extension.

Types

type ASRSpeechOptions

type ASRSpeechOptions struct {
	Language     string `json:"language,omitempty"`
	OnDeviceOnly bool   `json:"on_device_only,omitempty"`
}

type AudioOptions

type AudioOptions struct {
	BitRate    int    `json:"bit_rate,omitempty"`
	SampleRate int    `json:"sample_rate,omitempty"`
	Channels   int    `json:"channels,omitempty"`
	Codec      string `json:"codec,omitempty"`
}

type Capabilities

type Capabilities struct {
	Available       bool                   `json:"available"`
	Platform        string                 `json:"platform"`
	Actions         []string               `json:"actions"`
	Tools           map[string]bool        `json:"tools,omitempty"`
	Helper          HelperStatus           `json:"helper"`
	Document        map[string][]string    `json:"document,omitempty"`
	DocumentEngines []DocumentEngineInfo   `json:"document_engines,omitempty"`
	Image           map[string][]string    `json:"image,omitempty"`
	Audio           map[string][]string    `json:"audio,omitempty"`
	Video           map[string]interface{} `json:"video,omitempty"`
	Speech          map[string]interface{} `json:"speech,omitempty"`
	Retention       string                 `json:"retention,omitempty"`
	Notes           []string               `json:"notes,omitempty"`
	WorkingDir      string                 `json:"working_dir,omitempty"`
}

type ConvertOutput

type ConvertOutput struct {
	ID          string            `json:"output_id"`
	Name        string            `json:"name"`
	MimeType    string            `json:"mime_type,omitempty"`
	SizeBytes   int64             `json:"size_bytes,omitempty"`
	PreviewKind OutputPreviewKind `json:"preview_kind,omitempty"`
	DownloadURL string            `json:"download_url,omitempty"`
	Ref         string            `json:"ref,omitempty"`
	PreviewText string            `json:"preview_text,omitempty"`
	Path        string            `json:"path,omitempty"`
}

type ConvertTask

type ConvertTask struct {
	ID                string          `json:"task_id"`
	ConversationID    string          `json:"conversation_id,omitempty"`
	UserID            string          `json:"user_id,omitempty"`
	Action            string          `json:"action"`
	Status            TaskStatus      `json:"status"`
	Sources           []string        `json:"sources,omitempty"`
	TargetFormat      string          `json:"target_format,omitempty"`
	SourceSummary     string          `json:"source_summary,omitempty"`
	Progress          float64         `json:"progress,omitempty"`
	Message           string          `json:"message,omitempty"`
	Error             string          `json:"error,omitempty"`
	TranscriptPreview string          `json:"transcript_preview,omitempty"`
	Outputs           []ConvertOutput `json:"outputs,omitempty"`
	CreatedAt         time.Time       `json:"created_at"`
	UpdatedAt         time.Time       `json:"updated_at"`
	StartedAt         *time.Time      `json:"started_at,omitempty"`
	CompletedAt       *time.Time      `json:"completed_at,omitempty"`
	Request           *TaskRequest    `json:"-"`
}

type DocumentEngineInfo

type DocumentEngineInfo struct {
	ID        string   `json:"id"`
	Path      string   `json:"path,omitempty"`
	Available bool     `json:"available"`
	Priority  int      `json:"priority"`
	Formats   []string `json:"formats,omitempty"`
}

type DocumentOptions

type DocumentOptions struct {
	Pages []int `json:"pages,omitempty"`
}

type DocumentReadResult

type DocumentReadResult struct {
	Format         string                  `json:"format"`
	Text           string                  `json:"text"`
	TabularSummary *TabularWorkbookSummary `json:"tabular_summary,omitempty"`
	ExtractedVia   string                  `json:"extracted_via,omitempty"`
}

DocumentReadResult is the normalized read-only extraction payload used by the workspace read tool for office-style documents.

type DocumentReader

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

DocumentReader extracts readable text from local office-style documents without exposing convert tasks/output artifacts to callers.

func NewDocumentReader

func NewDocumentReader() *DocumentReader

NewDocumentReader creates a default document reader backed by local parsers and detected document engines.

func (*DocumentReader) ReadDocument

func (r *DocumentReader) ReadDocument(ctx context.Context, path string) (*DocumentReadResult, error)

ReadDocument extracts readable text from a local office-style document.

type Handler

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

func NewHandler

func NewHandler(service *Service, authorize func(ctx context.Context, userID, conversationID string) error) *Handler

func (*Handler) CancelTask

func (h *Handler) CancelTask(c echo.Context) error

func (*Handler) DownloadOutput

func (h *Handler) DownloadOutput(c echo.Context) error

func (*Handler) GetCapabilities

func (h *Handler) GetCapabilities(c echo.Context) error

func (*Handler) GetOutputLocation

func (h *Handler) GetOutputLocation(c echo.Context) error

func (*Handler) GetTask

func (h *Handler) GetTask(c echo.Context) error

func (*Handler) ListTasks

func (h *Handler) ListTasks(c echo.Context) error

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(g *echo.Group)

type HelperRunner

type HelperRunner struct{}

func NewHelperRunner

func NewHelperRunner() *HelperRunner

func (*HelperRunner) Run

func (r *HelperRunner) Run(ctx context.Context, payload map[string]interface{}) (*helperResponse, error)

func (*HelperRunner) Status

func (r *HelperRunner) Status() HelperStatus

type HelperStatus

type HelperStatus struct {
	Available bool   `json:"available"`
	Mode      string `json:"mode,omitempty"`
	Path      string `json:"path,omitempty"`
	Error     string `json:"error,omitempty"`
}

type ImageOptions

type ImageOptions struct {
	Quality int `json:"quality,omitempty"`
	Width   int `json:"width,omitempty"`
	Height  int `json:"height,omitempty"`
}

type OutputPreviewKind

type OutputPreviewKind string
const (
	PreviewFile  OutputPreviewKind = "file"
	PreviewAudio OutputPreviewKind = "audio"
	PreviewVideo OutputPreviewKind = "video"
	PreviewImage OutputPreviewKind = "image"
	PreviewPDF   OutputPreviewKind = "pdf"
	PreviewText  OutputPreviewKind = "text"
)

type PresentationOptions

type PresentationOptions struct {
	Theme     string `json:"theme,omitempty"`
	StyleHint string `json:"style_hint,omitempty"`
	Title     string `json:"title,omitempty"`
	Subtitle  string `json:"subtitle,omitempty"`
	Summary   string `json:"summary,omitempty"`
}

type ResolvedSource

type ResolvedSource struct {
	Ref      string `json:"ref"`
	Name     string `json:"name"`
	MimeType string `json:"mime_type,omitempty"`
	Path     string `json:"path"`
	Size     int64  `json:"size_bytes,omitempty"`
	Category string `json:"category,omitempty"`
}

type Service

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

func NewService

func NewService(db *sql.DB, dataDir string) (*Service, error)

func NewServiceWithReadDB

func NewServiceWithReadDB(writeDB, readDB *sql.DB, dataDir string) (*Service, error)

func (*Service) BuildPromptSummary

func (s *Service) BuildPromptSummary(ctx context.Context, userID, conversationID string, limit int) string

func (*Service) CancelTask

func (s *Service) CancelTask(ctx context.Context, userID, conversationID, taskID string) (*ConvertTask, error)

func (*Service) Capabilities

func (s *Service) Capabilities(ctx context.Context) Capabilities

func (*Service) Close

func (s *Service) Close() error

func (*Service) GetTask

func (s *Service) GetTask(ctx context.Context, userID, conversationID, taskID string) (*ConvertTask, error)

func (*Service) IsManagedPath

func (s *Service) IsManagedPath(path string) bool

func (*Service) ListTasks

func (s *Service) ListTasks(ctx context.Context, userID, conversationID string, limit int) ([]*ConvertTask, error)

func (*Service) RecordAttachment

func (s *Service) RecordAttachment(ctx context.Context, userID, conversationID, name, mimeType string, data []byte) (string, error)

func (*Service) ResolveDownload

func (s *Service) ResolveDownload(ctx context.Context, userID, conversationID, taskID, outputID string) (*ConvertTask, *ConvertOutput, error)

func (*Service) Submit

func (s *Service) Submit(ctx context.Context, userID, conversationID string, req TaskRequest) (*ConvertTask, error)

func (*Service) WaitForTask

func (s *Service) WaitForTask(ctx context.Context, userID, conversationID, taskID string, wait time.Duration) (*ConvertTask, error)

type SpeechOptions

type SpeechOptions struct {
	TTS TTSSpeechOptions `json:"tts,omitempty"`
	ASR ASRSpeechOptions `json:"asr,omitempty"`
}

type Store

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

func NewStore

func NewStore(db *sql.DB) (*Store, error)

func NewStoreWithReadDB

func NewStoreWithReadDB(writeDB, readDB *sql.DB) (*Store, error)

func (*Store) CleanupExpired

func (s *Store) CleanupExpired(cutoff time.Time) (taskIDs []string, taskRoots []string, sourcePaths []string, err error)

func (*Store) CreateSource

func (s *Store) CreateSource(source *StoredSource) error

func (*Store) CreateTask

func (s *Store) CreateTask(task *ConvertTask) error

func (*Store) GetSource

func (s *Store) GetSource(sourceID string) (*StoredSource, error)

func (*Store) GetTask

func (s *Store) GetTask(taskID string) (*ConvertTask, error)

func (*Store) ListSources

func (s *Store) ListSources(userID, conversationID string, limit int) ([]*StoredSource, error)

func (*Store) ListTasks

func (s *Store) ListTasks(userID, conversationID string, limit int) ([]*ConvertTask, error)

func (*Store) MarkInterruptedTasksFailed

func (s *Store) MarkInterruptedTasksFailed(message string) error

func (*Store) UpdateTask

func (s *Store) UpdateTask(task *ConvertTask) error

type StoredSource

type StoredSource struct {
	ID             string    `json:"id"`
	UserID         string    `json:"user_id"`
	ConversationID string    `json:"conversation_id"`
	Name           string    `json:"name"`
	MimeType       string    `json:"mime_type,omitempty"`
	Path           string    `json:"path"`
	SizeBytes      int64     `json:"size_bytes,omitempty"`
	CreatedAt      time.Time `json:"created_at"`
}

type TTSSpeechOptions

type TTSSpeechOptions struct {
	Voice  string `json:"voice,omitempty"`
	Rate   int    `json:"rate,omitempty"`
	Format string `json:"format,omitempty"`
}

type TabularSummary

type TabularSummary struct {
	Source        string                                   `json:"source,omitempty"`
	RowCount      int                                      `json:"row_count"`
	FormulaCount  int                                      `json:"formula_count,omitempty"`
	Headers       []string                                 `json:"headers,omitempty"`
	DateColumns   []string                                 `json:"date_columns,omitempty"`
	ColumnKinds   map[string]string                        `json:"column_kinds,omitempty"`
	NumericTotals map[string]float64                       `json:"numeric_totals,omitempty"`
	GroupedTotals map[string]map[string]map[string]float64 `json:"grouped_totals,omitempty"`
	TopByMetric   map[string]map[string]TabularTopValue    `json:"top_by_metric,omitempty"`
	ChangedCells  int                                      `json:"changed_cells,omitempty"`
	Highlights    []string                                 `json:"highlights,omitempty"`
}

func SummarizeDelimitedFile

func SummarizeDelimitedFile(path string) (*TabularSummary, error)

type TabularTopValue

type TabularTopValue struct {
	Value string  `json:"value"`
	Total float64 `json:"total"`
}

type TabularWorkbookSummary

type TabularWorkbookSummary struct {
	SheetSummaries []TabularSummary `json:"sheet_summaries,omitempty"`
	Highlights     []string         `json:"highlights,omitempty"`
}

type TaskOptions

type TaskOptions struct {
	Document     DocumentOptions     `json:"document,omitempty"`
	Presentation PresentationOptions `json:"presentation,omitempty"`
	Image        ImageOptions        `json:"image,omitempty"`
	Audio        AudioOptions        `json:"audio,omitempty"`
	Video        VideoOptions        `json:"video,omitempty"`
	Speech       SpeechOptions       `json:"speech,omitempty"`
}

type TaskRequest

type TaskRequest struct {
	Action       string      `json:"action"`
	Sources      []string    `json:"sources,omitempty"`
	TargetFormat string      `json:"target_format,omitempty"`
	OutputPath   string      `json:"output_path,omitempty"`
	Text         string      `json:"text,omitempty"`
	TaskID       string      `json:"task_id,omitempty"`
	WaitMS       int         `json:"wait_ms,omitempty"`
	Options      TaskOptions `json:"options,omitempty"`
}

type TaskStatus

type TaskStatus string
const (
	StatusPending    TaskStatus = "pending"
	StatusProcessing TaskStatus = "processing"
	StatusSucceeded  TaskStatus = "succeeded"
	StatusFailed     TaskStatus = "failed"
	StatusCancelled  TaskStatus = "cancelled"
)

func (TaskStatus) IsTerminal

func (s TaskStatus) IsTerminal() bool

type TimeSegment

type TimeSegment struct {
	StartMS int64 `json:"start_ms,omitempty"`
	EndMS   int64 `json:"end_ms,omitempty"`
}

type VideoOptions

type VideoOptions struct {
	Codec           string        `json:"codec,omitempty"`
	Width           int           `json:"width,omitempty"`
	Height          int           `json:"height,omitempty"`
	FrameRate       int           `json:"frame_rate,omitempty"`
	BitRate         int           `json:"bit_rate,omitempty"`
	StartMS         int64         `json:"start_ms,omitempty"`
	EndMS           int64         `json:"end_ms,omitempty"`
	FrameIntervalMS int64         `json:"frame_interval_ms,omitempty"`
	Segments        []TimeSegment `json:"segments,omitempty"`
}

Jump to

Keyboard shortcuts

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