mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2026-11-09 17:06:40 +00:00
Исправления в ветке main
This commit is contained in:
@@ -105,6 +105,7 @@ func processExplanation(detailedSystem, ask string, gpt3 gpt.Gpt3, timeout int,
|
||||
if config.AppConfig.MainFlags.Debug {
|
||||
printVerboseDebugInfo(detailedSystem, ask, gpt3, timeout, level)
|
||||
}
|
||||
config.DebugLogf("[EXPLAIN] level=%d timeout=%d query=%s", level, timeout, ask)
|
||||
detailed := gpt.NewGpt3(gpt3.ProviderType, config.AppConfig.Host, gpt3.ApiKey, gpt3.Model, detailedSystem, 0.2, timeout)
|
||||
|
||||
deps.PrintColored("\n🧠 Получаю подробное объяснение...\n", deps.ColorPurple)
|
||||
@@ -143,7 +144,7 @@ func processExplanation(detailedSystem, ask string, gpt3 gpt.Gpt3, timeout int,
|
||||
// saveExplanation сохраняет подробное объяснение и альтернативные способы
|
||||
func saveExplanation(explanation string, model string, originalCmd string, commandResponse string, resultFolder string) {
|
||||
timestamp := time.Now().Format("2006-01-02_15-04-05")
|
||||
filename := fmt.Sprintf("gpt_explanation_%s_%s.md", model, timestamp)
|
||||
filename := fmt.Sprintf("gpt_explanation_%s_%s.md", config.SafeFileName(model), timestamp)
|
||||
filePath := path.Join(resultFolder, filename)
|
||||
title := truncateTitle(originalCmd)
|
||||
content := fmt.Sprintf(
|
||||
@@ -154,6 +155,10 @@ func saveExplanation(explanation string, model string, originalCmd string, comma
|
||||
model,
|
||||
explanation,
|
||||
)
|
||||
if err := os.MkdirAll(path.Dir(filePath), 0755); err != nil {
|
||||
fmt.Println("Failed to create result folder:", err)
|
||||
return
|
||||
}
|
||||
if err := os.WriteFile(filePath, []byte(content), 0644); err != nil {
|
||||
fmt.Println("Failed to save explanation:", err)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user