importer

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyAsset

func CopyAsset(srcPath, assetsDir string) (string, error)

CopyAsset copies a file to the assets directory using its SHA-256 hash as the filename. Returns the asset:// reference. Only passive image types are accepted; active content is rejected.

func ExtractZip

func ExtractZip(zipPath string) (string, func(), error)

ExtractZip extracts a zip file to a temporary directory. Returns the directory path and a cleanup function that removes it. The caller must call cleanup when done.

Types

type AssetIndex

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

AssetIndex maps asset pointer prefixes to file paths on disk.

func BuildAssetIndex

func BuildAssetIndex(exportDir string) AssetIndex

BuildAssetIndex scans an export directory for image assets. ChatGPT exports store images in three locations:

  • dalle-generations/ (DALL-E outputs)
  • user-*/ directories (user uploads via sediment://)
  • root directory as file-* (user uploads via file-service://)

func (AssetIndex) Resolve

func (idx AssetIndex) Resolve(pointer string) (string, bool)

Resolve maps an asset pointer URL to a file path.

type ImportCallbacks

type ImportCallbacks struct {
	// OnProgress fires after each conversation with current
	// cumulative stats.
	OnProgress func(ImportStats)
	// OnIndexing fires before the FTS index rebuild starts.
	OnIndexing func()
}

ImportCallbacks provides optional progress reporting.

type ImportStats

type ImportStats struct {
	Imported int `json:"imported"`
	Updated  int `json:"updated"`
	Skipped  int `json:"skipped"`
	Errors   int `json:"errors"`
}

ImportStats reports the outcome of an import operation.

func ImportChatGPT

func ImportChatGPT(
	ctx context.Context,
	store db.Store,
	dir string,
	assetsDir string,
	cb *ImportCallbacks,
) (stats ImportStats, retErr error)

ImportChatGPT reads a ChatGPT export directory (containing conversations-*.json files) and imports each conversation into the store. Existing sessions are skipped to preserve archived data.

func ImportClaudeAI

func ImportClaudeAI(
	ctx context.Context,
	store db.Store,
	r io.Reader,
	cb *ImportCallbacks,
) (stats ImportStats, retErr error)

ImportClaudeAI reads a Claude.ai conversations.json export and upserts each conversation into the store. Existing sessions are updated (messages replaced); user-renamed display names are preserved. Excluded (deleted) sessions are counted as skipped.

Jump to

Keyboard shortcuts

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