File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
services/copilot/embedding Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ import consola from "consola"
2+ import { Hono } from "hono"
3+ import { FetchError } from "ofetch"
4+
5+ import { embedding } from "~/services/copilot/embedding/service"
6+
7+ export const embeddingRoutes = new Hono ( )
8+
9+ embeddingRoutes . post ( "/" , async ( c ) => {
10+ try {
11+ const embeddings = await embedding ( )
12+ return c . json ( embeddings )
13+ } catch ( error ) {
14+ if ( error instanceof FetchError ) {
15+ consola . error ( `Request failed: ${ error . message } ` , error . response ?. _data )
16+ }
17+ throw error
18+ }
19+ } )
Original file line number Diff line number Diff line change 1+ import type { GetModelsResponse } from "~/services/copilot/get-models/types.ts"
2+
3+ import { copilot } from "../../api-instance"
4+
5+ export const embedding = ( ) =>
6+ copilot < GetModelsResponse > ( "/embeddings" , {
7+ method : "POST" ,
8+ } )
You can’t perform that action at this time.
0 commit comments