1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 01:09:54 +00:00

title generation

This commit is contained in:
Laura
2025-08-25 22:45:03 +02:00
parent 3eac1a0795
commit 82e91cfc3e
14 changed files with 392 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"context"
"errors"
"github.com/revrost/go-openrouter"
)
@@ -28,7 +29,16 @@ func OpenRouterStartStream(ctx context.Context, request openrouter.ChatCompletio
func OpenRouterRun(ctx context.Context, request openrouter.ChatCompletionRequest) (openrouter.ChatCompletionResponse, error) {
client := OpenRouterClient()
return client.CreateChatCompletion(ctx, request)
response, err := client.CreateChatCompletion(ctx, request)
if err != nil {
return response, err
}
if len(response.Choices) == 0 {
return response, errors.New("no choices")
}
return response, nil
}
func OpenRouterGetGeneration(ctx context.Context, id string) (openrouter.Generation, error) {