[Prototype] Self-hosted CodeLlama LLM for code autocompletion #576
[Prototype] Self-hosted CodeLlama LLM for code autocompletion #576senwang86 wants to merge 6 commits intocodepod-io:mainfrom
Conversation
I also came across multiple providers the other day, and it is well supported: trpc#3049. I have implemented multiple providers in https://github.com/codepod-io/codepod-cloud/pull/11. Related code: |
|
With that said, it could actually be better and simpler to leave it in |
lihebi
left a comment
There was a problem hiding this comment.
Thanks, Sen! It works well. I left some minor comments in the code.
One issue is the automatic completion by InlineCompletionsProvider is not very responsiveness. Sometimes it is fired, and sometimes it is not. How about using a shortcut to trigger it manually, and disable the automatic triggering?
| http_server.listen({ port }, () => { | ||
| console.log(`🚀 Server ready at http://localhost:${port}`); | ||
| console.log( | ||
| `🚀 Server ready at http://localhost:${port}, LLM Copilot is hosted at ${copilotIpAddress}:${copilotPort}` |
There was a problem hiding this comment.
I'd revert this print information, because people may choose to run CodePod without copilot server, and this info is misleading. Just be silent should be fine.
ui/src/lib/trpc.ts
Outdated
| } else { | ||
| remoteUrl = `${window.location.hostname}:${window.location.port}`; | ||
| } | ||
| export const trpcProxyClient = createTRPCProxyClient<AppRouter>({ |
There was a problem hiding this comment.
We already have a trpc client in App.tsx. You can access the client in llamaInlineCompletionProvider like this:
// MyMonaco.tsx
function MyMonaco() {
...
const { client } = trpc.useUtils();
const llamaCompletionProvider = new llamaInlineCompletionProvider(
id,
editor,
client
);
}There was a problem hiding this comment.
A second thought: since the copilot is already a REST API, and we are not going to further customize it or add authentication to this Desktop app, let's directly call the REST API in the frontend.
The trpc is preferred in the cloud app.
This isn't that critical. We can assume that the service is up.
This is quite important. It is quite often that we edit code in the middle. |
|
After the discussion, we decide to leave this PR as a reference to integrate the self-hosted copilot and address the comments in the codepod-cloud repo. |

Summary
This pr provides a solution to use CodeLlama for self-hosted code autocompletion.
api/src/server, initially we talked about to create an standalone server service to the copilot-related services.Test
x.x.x.x, port is9090cd codepod/api/pnpm dev --copilotIP x.x.x.x --copilotPort 9090