Documentation
¶
Index ¶
- func Contains(strRange []string, pattern string) bool
- func ErrChk(err error)
- func Filter(arr []string, cond func(string) bool) []string
- func ListProductMeta(conf *Config)
- func OpenAIGenSystemPrompt() string
- func OpenAIProcess(conf *Config, userPrompt string) (string, string, error)
- func OpenAIUserPrompt(productName string, shortDescription string, description string, ...) string
- func PathExist(path string) bool
- func Run()
- func UpdateSEO(conf *Config, restartTracking bool, prompt bool) error
- func UploadImageToWordPress(conf *Config, imageDirPath string) error
- func WriteDefaultConfig(configPath string, defaultConfig *Config) error
- type Category
- type Config
- type JSONResponse
- type ProductCache
- type ProductMeta
- type TrackerUpdate
- type WooCategory
- type WooMetaData
- type WooProduct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListProductMeta ¶
func ListProductMeta(conf *Config)
func OpenAIGenSystemPrompt ¶
func OpenAIGenSystemPrompt() string
------------------------------------------------------------------- OpenAI logic (unchanged) -------------------------------------------------------------------
func OpenAIUserPrompt ¶
func OpenAIUserPrompt(productName string, shortDescription string, description string, categories []WooCategory) string
func UpdateSEO ¶
------------------------------------------------------------------- UpdateSEO now has a restartTracking param and uses the tracker -------------------------------------------------------------------
func UploadImageToWordPress ¶
func WriteDefaultConfig ¶
Types ¶
type Config ¶
type Config struct { Site string `yaml:"site"` OpenAIKey string `yaml:"openai_key"` WpUser string `yaml:"wp_user"` WpKey string `yaml:"wp_key"` WooConsumerKey string `yaml:"consumer_key"` WooConsumerSecret string `yaml:"consumer_secret"` CacheFilename string `yaml:"cache_filename"` TrackerFilename string `yaml:"tracker_filename"` ProductMeta ProductMeta `yaml:"product_meta"` }
func ReadConfig ¶
type JSONResponse ¶
type ProductCache ¶
type ProductCache struct { Products []map[string]interface{} `json:"products"` LastUpdate time.Time `json:"last_update"` // contains filtered or unexported fields }
func (*ProductCache) FetchFromCache ¶
func (*ProductCache) SaveToCache ¶
func (pc *ProductCache) SaveToCache(cacheFilePath string, products []WooProduct)
type ProductMeta ¶
type TrackerUpdate ¶
type TrackerUpdate struct { UpdatedIDs map[int]bool `json:"updated_ids"` // contains filtered or unexported fields }
func TrackerLoad ¶
func TrackerLoad(filePath string) (*TrackerUpdate, error)
type WooCategory ¶
type WooMetaData ¶
type WooProduct ¶
type WooProduct struct { ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` ShortDescription string `json:"short_description"` Categories []WooCategory `json:"categories"` MetaData []WooMetaData `json:"meta_data"` }
func GetProducts ¶
func GetProducts(conf *Config, maxCacheAge time.Duration) ([]WooProduct, error)
------------------------------------------------------------------- Fetch WooCommerce products, with cache -------------------------------------------------------------------
Click to show internal directories.
Click to hide internal directories.