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:
@@ -19,6 +19,10 @@ func pathJoin(base, name string) string {
|
||||
}
|
||||
|
||||
func writeFile(filePath, content string) {
|
||||
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 response:", err)
|
||||
} else {
|
||||
@@ -28,7 +32,7 @@ func writeFile(filePath, content string) {
|
||||
|
||||
func saveResponse(response string, gpt3Model string, prompt string, cmd string, explanation ...string) {
|
||||
timestamp := nowTimestamp()
|
||||
filename := fmt.Sprintf("gpt_request_%s_%s.md", gpt3Model, timestamp)
|
||||
filename := fmt.Sprintf("gpt_request_%s_%s.md", config.SafeFileName(gpt3Model), timestamp)
|
||||
filePath := pathJoin(config.AppConfig.ResultFolder, filename)
|
||||
title := truncateTitle(cmd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user