mirror of
https://github.com/xzeldon/whisper-api-server.git
synced 2025-07-13 16:54:37 +03:00
Compare commits
2 Commits
v0.1.1
...
7b0797cca1
Author | SHA1 | Date | |
---|---|---|---|
7b0797cca1
|
|||
482616fb4c
|
@ -38,10 +38,9 @@ Receive a response in JSON format:
|
||||
|
||||
# Usage with [Obsidian](https://obsidian.md/)
|
||||
|
||||
To integrate this with the [Obsidian voice recognotion plugin](https://github.com/nikdanilov/whisper-obsidian-plugin), follow these steps:
|
||||
|
||||
1. Open the plugin's settings.
|
||||
2. Set the following values:
|
||||
1. Install [Obsidian voice recognotion plugin](https://github.com/nikdanilov/whisper-obsidian-plugin)
|
||||
2. Open the plugin's settings.
|
||||
3. Set the following values:
|
||||
- API KEY: `sk-1`
|
||||
- API URL: `http://localhost:3000/v1/audio/transcriptions`
|
||||
- Model: `whisper-1`
|
||||
|
@ -22,9 +22,14 @@ func saveFormFile(name string, c echo.Context) (string, error) {
|
||||
}
|
||||
defer src.Close()
|
||||
|
||||
tmpDir, err := ensureDir("tmp")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
ext := filepath.Ext(file.Filename)
|
||||
filename := time.Now().Format(time.RFC3339)
|
||||
filename = "./tmp/" + sanitizeFilename(filename) + ext
|
||||
filename = tmpDir + "/" + sanitizeFilename(filename) + ext
|
||||
|
||||
dst, err := os.Create(filename)
|
||||
if err != nil {
|
||||
@ -46,3 +51,14 @@ func sanitizeFilename(filename string) string {
|
||||
}
|
||||
return filename
|
||||
}
|
||||
|
||||
func ensureDir(dirPath string) (string, error) {
|
||||
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
|
||||
err := os.MkdirAll(dirPath, 0700)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
return dirPath, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user