Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Nov 6, 2024
1 parent 00b6ac5 commit eabd561
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const copilotPlugins = [
- If no context is provided or you can't generate a continuation, return "0" without explanation.`,
},
onError: () => {
// Mock the API response. Remove it when you implement the route /api/ai/copilot
api.copilot.setBlockSuggestion({
text: stripMarkdown(faker.lorem.sentence()),
});
Expand All @@ -36,7 +37,6 @@ export const copilotPlugins = [
if (completion === '0') return;

api.copilot.setBlockSuggestion({
//stripMarkdownBlocks in plus GhostText
text: stripMarkdown(completion),
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export const useChat = () => {
model: useOpenAI().model.value,
},
fetch: async (input, init) => {
try {
return await fetch(input, init);
} catch (error) {
// Mock the API response. Remove it when you implement the route /api/ai
const res = await fetch(input, init);

if (!res.ok) {
// Mock the API response. Remove it when you implement the route /api/ai/command
await new Promise((resolve) => setTimeout(resolve, 400));

const stream = fakeStreamText();
Expand All @@ -65,6 +65,8 @@ export const useChat = () => {
},
});
}

return res;
},
});
};
Expand Down

0 comments on commit eabd561

Please sign in to comment.