MCPcopy Create free account
hub / github.com/Exafunction/codeium-chrome / getCompletions

Method getCompletions

src/common.ts:73–106  ·  view source on GitHub ↗
(
    request: GetCompletionsRequest
  )

Source from the content-addressed store, hash-verified

71 }
72
73 async getCompletions(
74 request: GetCompletionsRequest
75 ): Promise<GetCompletionsResponse | undefined> {
76 this.abortController?.abort();
77 this.abortController = new AbortController();
78 const signal = this.abortController.signal;
79 const getCompletionsPromise = (await this.client).getCompletions(request, {
80 signal,
81 headers: this.getHeaders(request.metadata?.apiKey),
82 });
83 try {
84 return await getCompletionsPromise;
85 } catch (err) {
86 if (signal.aborted) {
87 return;
88 }
89 if (err instanceof ConnectError) {
90 if (err.code != Code.Canceled) {
91 console.log(err.message);
92 await chrome.runtime.sendMessage(chrome.runtime.id, {
93 type: 'error',
94 message: err.message,
95 });
96 }
97 } else {
98 console.log((err as Error).message);
99 await chrome.runtime.sendMessage(chrome.runtime.id, {
100 type: 'error',
101 message: (err as Error).message,
102 });
103 }
104 return;
105 }
106 }
107
108 async acceptedLastCompletion(
109 acceptCompletionRequest: PartialMessage<AcceptCompletionRequest>

Callers

nothing calls this directly

Calls 2

getHeadersMethod · 0.95
getCompletionsMethod · 0.45

Tested by

no test coverage detected