Skip to content

Commit

Permalink
add document when request base page
Browse files Browse the repository at this point in the history
  • Loading branch information
zuisong committed Jan 15, 2024
1 parent ce1389d commit 7c399ed
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,31 @@ export const app = new Hono({ strict: true })
const logger = gen_logger(crypto.randomUUID())
c.set("log", logger)
await next()
c.set("log", undefined)
c.set("log", undefined as unknown as Logger)
})
.options("*", (c) => c.text("", 204))
.get("/", (c) => c.text(`Hello Gemini-OpenAI-Proxy from ${getRuntimeKey()}!`))
.get("/", (c) => {
const origin = new URL(c.req.url).origin
return c.html(
`<pre>
Hello Gemini-OpenAI-Proxy from ${getRuntimeKey()}!
You can try it with:
curl ${origin}/v1/chat/completions \\
-H "Authorization: Bearer $YOUR_GEMINI_API_KEY" \\
-H "Content-Type: application/json" \\
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Hello"}],
"temperature": 0.7
}'
</pre>`,
)
})
.post("/v1/chat/completions", chatProxyHandler)

export type ContextWithLogger = Context<{ Variables: { log: Logger } }>

0 comments on commit 7c399ed

Please sign in to comment.