Spaces:
Paused
Paused
Commit
·
0317226
1
Parent(s):
67ba65c
Update app/editor/copilot.ts
Browse files- app/editor/copilot.ts +3 -7
app/editor/copilot.ts
CHANGED
@@ -75,11 +75,7 @@ async function fetchCompletionFromllm(
|
|
75 |
authorization: `Bearer ${config.llmKey}`,
|
76 |
},
|
77 |
body: JSON.stringify({
|
78 |
-
|
79 |
-
messages: [
|
80 |
-
{role: "assistant", content: "You are a helpful assistant, complete the following code"},
|
81 |
-
{role: "user", content: config.assistantMessage + '\n' + minimizeWhitespace(code)},
|
82 |
-
],
|
83 |
...config.llmParams,
|
84 |
}),
|
85 |
signal: controller.signal,
|
@@ -91,8 +87,8 @@ async function fetchCompletionFromllm(
|
|
91 |
}
|
92 |
try {
|
93 |
const response = JSON.parse(data);
|
94 |
-
if ((lastResponse = response == null ? void 0 : response
|
95 |
-
text += response
|
96 |
handleMessage == null ? void 0 : handleMessage(text);
|
97 |
}
|
98 |
} catch (err) {
|
|
|
75 |
authorization: `Bearer ${config.llmKey}`,
|
76 |
},
|
77 |
body: JSON.stringify({
|
78 |
+
prompt
|
|
|
|
|
|
|
|
|
79 |
...config.llmParams,
|
80 |
}),
|
81 |
signal: controller.signal,
|
|
|
87 |
}
|
88 |
try {
|
89 |
const response = JSON.parse(data);
|
90 |
+
if ((lastResponse = response == null ? void 0 : response) == null ? void 0 : lastResponse.length) {
|
91 |
+
text += response || '';
|
92 |
handleMessage == null ? void 0 : handleMessage(text);
|
93 |
}
|
94 |
} catch (err) {
|