Stop sending prompt to Whisper transcription
This commit is contained in:
@@ -133,7 +133,7 @@ func envCSVDefault(key string, fallback []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func defaultAudioPrompt() string {
|
func defaultAudioPrompt() string {
|
||||||
return "Расшифруй речь из аудио максимально точно. Сохрани русский язык, имена, телефоны, суммы и смысловые паузы. Не добавляй комментарии, анализ, Markdown или JSON. Верни только чистый текст расшифровки."
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func hostname() string {
|
func hostname() string {
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ func New(baseURL string, timeout time.Duration, ffmpegPath string, leadSilence t
|
|||||||
|
|
||||||
func NewWithOptions(opts Options) *Client {
|
func NewWithOptions(opts Options) *Client {
|
||||||
audioPrompt := strings.TrimSpace(opts.AudioPrompt)
|
audioPrompt := strings.TrimSpace(opts.AudioPrompt)
|
||||||
if audioPrompt == "" {
|
|
||||||
audioPrompt = "Transcribe the audio exactly. Return only the transcript text."
|
|
||||||
}
|
|
||||||
provider := buildAudioProvider(opts, audioPrompt)
|
provider := buildAudioProvider(opts, audioPrompt)
|
||||||
if provider.BaseURL == "" {
|
if provider.BaseURL == "" {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func TestWhisperUsesAudioTranscriptionsEndpoint(t *testing.T) {
|
|||||||
}))
|
}))
|
||||||
defer audioSrv.Close()
|
defer audioSrv.Close()
|
||||||
|
|
||||||
var gotPath, gotModel, gotResponseFormat string
|
var gotPath, gotModel, gotResponseFormat, gotPrompt string
|
||||||
providerSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
providerSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
gotPath = r.URL.Path
|
gotPath = r.URL.Path
|
||||||
if err := r.ParseMultipartForm(16 << 20); err != nil {
|
if err := r.ParseMultipartForm(16 << 20); err != nil {
|
||||||
@@ -36,6 +36,7 @@ func TestWhisperUsesAudioTranscriptionsEndpoint(t *testing.T) {
|
|||||||
}
|
}
|
||||||
gotModel = r.FormValue("model")
|
gotModel = r.FormValue("model")
|
||||||
gotResponseFormat = r.FormValue("response_format")
|
gotResponseFormat = r.FormValue("response_format")
|
||||||
|
gotPrompt = r.FormValue("prompt")
|
||||||
if _, _, err := r.FormFile("file"); err != nil {
|
if _, _, err := r.FormFile("file"); err != nil {
|
||||||
t.Fatalf("FormFile: %v", err)
|
t.Fatalf("FormFile: %v", err)
|
||||||
}
|
}
|
||||||
@@ -69,6 +70,9 @@ func TestWhisperUsesAudioTranscriptionsEndpoint(t *testing.T) {
|
|||||||
if gotResponseFormat != "json" {
|
if gotResponseFormat != "json" {
|
||||||
t.Fatalf("response_format = %q, want json", gotResponseFormat)
|
t.Fatalf("response_format = %q, want json", gotResponseFormat)
|
||||||
}
|
}
|
||||||
|
if gotPrompt != "" {
|
||||||
|
t.Fatalf("prompt = %q, want empty", gotPrompt)
|
||||||
|
}
|
||||||
if len(got.Segments) != 2 || got.Segments[0].Text != "Алло, тест." || got.Segments[1].Start != 1.2 {
|
if len(got.Segments) != 2 || got.Segments[0].Text != "Алло, тест." || got.Segments[1].Start != 1.2 {
|
||||||
t.Fatalf("segments = %#v", got.Segments)
|
t.Fatalf("segments = %#v", got.Segments)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user