This commit is contained in:
2026-09-15 09:15:53 -05:00
parent 97c930196a
commit ab9573b875
21 changed files with 1664 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
package main
import (
"context"
"net/http"
"os"
"time"
"github.com/inngest/inngestgo"
openrouter "github.com/OpenRouterTeam/go-sdk"
"github.com/OpenRouterTeam/go-sdk/models/components"
)
func main() {
client, err := inngestgo.NewClient(inngestgo.ClientOpts{
AppID: "worker",
})
if err != nil {
panic("Couldn't initialize inngest client")
}
_, err = inngestgo.CreateFunction(
client,
inngestgo.FunctionOpts{
ID: "create-new-fish",
},
inngestgo.CronTriggerWithJitter("0 0 * * *", time.Duration(60)*time.Minute),
CreateNewFishCron,
)
http.ListenAndServe(":3000", client.Serve())
}
func CreateNewFish(ctx context.Context) {
s := openrouter.New(
openrouter.WithSecurity(os.Getenv("OPENROUTER_API_KEY")),
)
res, err := s.Chat.Send(ctx, components.ChatRequest{})
}
func CreateNewFishCron(ctx context.Context, input inngestgo.Input[any]) (any, error) {
CreateNewFish()
return nil, nil
}