File tree Expand file tree Collapse file tree
services/copilot/embedding Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,13 +2,17 @@ import consola from "consola"
22import { Hono } from "hono"
33import { FetchError } from "ofetch"
44
5+ import type { ChatCompletionsPayload } from "~/services/copilot/chat-completions/types.ts"
6+
57import { embedding } from "~/services/copilot/embedding/service"
68
79export const embeddingRoutes = new Hono ( )
810
911embeddingRoutes . post ( "/" , async ( c ) => {
1012 try {
11- const embeddings = await embedding ( )
13+ const embeddings = await embedding (
14+ await c . req . json < ChatCompletionsPayload > ( ) ,
15+ )
1216 return c . json ( embeddings )
1317 } catch ( error ) {
1418 if ( error instanceof FetchError ) {
Original file line number Diff line number Diff line change 1+ import type { ChatCompletionsPayload } from "~/services/copilot/chat-completions/types.ts"
12import type { GetModelsResponse } from "~/services/copilot/get-models/types.ts"
23
34import { copilot } from "../../api-instance"
45
5- export const embedding = ( ) =>
6+ export const embedding = ( payload : ChatCompletionsPayload ) =>
67 copilot < GetModelsResponse > ( "/embeddings" , {
78 method : "POST" ,
9+ body : {
10+ ...payload ,
11+ } ,
812 } )
You can’t perform that action at this time.
0 commit comments