File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
src/services/copilot/chat-completions Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1+ import { stream } from "fetch-event-stream"
2+
13import type { ChatCompletionsPayload } from "./types"
2- import type { ChatCompletionsChunk } from "./types-streaming"
34
4- import { copilot } from "../../api-instance"
5+ import { COPILOT_CONFIG } from "../../../config/api"
6+ import { TOKENS } from "../../../config/tokens"
57
6- export const chatCompletionsStream = ( payload : ChatCompletionsPayload ) =>
7- copilot < ChatCompletionsChunk > ( " /chat/completions" , {
8+ export const chatCompletionsStream = async ( payload : ChatCompletionsPayload ) =>
9+ stream ( ` ${ COPILOT_CONFIG . baseURL } /chat/completions` , {
810 method : "POST" ,
9- body : payload ,
11+ headers : {
12+ ...COPILOT_CONFIG . headers ,
13+ authorization : `Bearer ${ TOKENS . COPILOT_TOKEN } ` ,
14+ } ,
15+ body : JSON . stringify ( payload ) ,
1016 } )
You can’t perform that action at this time.
0 commit comments