Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for chat #199

Open
drewwells opened this issue Nov 9, 2023 · 19 comments
Open

Support for chat #199

drewwells opened this issue Nov 9, 2023 · 19 comments
Labels

Comments

@drewwells
Copy link

Chat goes publicly available soon. Would be good to integrate it. It's a very useful tool but we're unable to use it in eMacs right now

https://github.blog/2023-11-08-universe-2023-copilot-transforms-github-into-the-ai-powered-developer-platform/

@rakotomandimby
Copy link
Collaborator

@drewwells , as far as I am used to @zerolfx answers, if Github integrates it in the neovim plugin or releases a separate neovim plugin for that, it would be possible to go.

@shroomist
Copy link

I'm not a user of neovim, I couldn't validate, but I see traces of chat functionality in neovim repo command:workbench.panel.chat.view.copilot.focus

@emil-vdw
Copy link
Collaborator

This would indeed be a good feature to add IMO. Correct me if I'm wrong but this has not officially released (in general and as a feature of the neovim plugin)? I will keep this issue open so we can monitor the situation.

@wrn
Copy link

wrn commented Dec 12, 2023

I am eagerly waiting for this feature. A lot of thanks in advance.

@sylvesterroos
Copy link

There is this project that implements Chat support for Neovim. It's unofficial, and I haven't tested this (I don't use nvim as my code editor), but according to the README it works

@FengqiuAdamDong
Copy link

I believe Neovim maybe be getting chat soon
https://github.com/orgs/community/discussions/50939

@jcs090218 jcs090218 mentioned this issue Apr 15, 2024
@xz-dev
Copy link

xz-dev commented Apr 20, 2024

https://github.com/CopilotC-Nvim/CopilotChat.nvim

@Aneeqasif
Copy link

https://github.com/CopilotC-Nvim/CopilotChat.nvim

any chance of getting it in emacs? @devs

@xz-dev xz-dev mentioned this issue Jun 29, 2024
@chep
Copy link

chep commented Jul 9, 2024

Hi,

I created a repository : https://github.com/chep/copilot-chat.el

I'm using neovim plugin code to implement copilot chat.

Currently, I'm able to ask something to copilot. The answer is printed in a buffer.
Exemple for (copilot-chat-ask "write me a simple UDP server in C")

Copilot answer:
Sure, here's a simple UDP server written in C. This server will receive a message from a client, print it, and then send a response back.

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>

#define BUF_SIZE 1024
#define PORT 8888

void error_handling(char *message);

int main(int argc, char *argv[])
{
    int serv_sock;
    char message[BUF_SIZE];
    struct sockaddr_in serv_addr;
    struct sockaddr_in clnt_addr;
    socklen_t clnt_addr_size;

    serv_sock = socket(PF_INET, SOCK_DGRAM, 0);
    if (serv_sock == -1)
        error_handling("UDP socket creation error");

    memset(&serv_addr, 0, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
    serv_addr.sin_port = htons(PORT);

    if (bind(serv_sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) == -1)
        error_handling("bind() error");

    while(1) {
        clnt_addr_size = sizeof(clnt_addr);
        int str_len = recvfrom(serv_sock, message, BUF_SIZE, 0, (struct sockaddr*)&clnt_addr, &clnt_addr_size);
        if (str_len == -1)
            error_handling("recvfrom() error");

        printf("Received from client: %s\n", message);

        sendto(serv_sock, message, str_len, 0, (struct sockaddr*)&clnt_addr, clnt_addr_size);
    }

    close(serv_sock);
    return 0;
}

void error_handling(char *message)
{
    fputs(message, stderr);
    fputc('\n', stderr);
    exit(1);
}
``

This server listens on port 8888 and uses the `recvfrom` function to receive data from a client. It then sends the same data back to the client using the `sendto` function. The `error_handling` function is used to display error messages and terminate the program in case of any errors.

(I just removed a backquote to have a pretty print in github)

Feel free to help me improving this or to use it for integration in copilot.el.

@Aneeqasif
Copy link

lovely, does it have any workspace awareness?? like in vscode because that's the thing that separates copilot chat from other ai plugins

@xz-dev
Copy link

xz-dev commented Jul 9, 2024

lovely, does it have any workspace awareness?? like in vscode because that's the thing that separates copilot chat from other ai plugins

I think it can simply plus file content and path in chat

@Aneeqasif
Copy link

looking forward for the package. i hope the features get polished in future. I willl test it out and get back to you with some reviews : )

@chep
Copy link

chep commented Jul 9, 2024

lovely, does it have any workspace awareness?? like in vscode because that's the thing that separates copilot chat from other ai plugins

It's only one day of work so for the moment I can authenticate, send a prompt and parse answer. That's all.

@Aneeqasif
Copy link

lovely, does it have any workspace awareness?? like in vscode because that's the thing that separates copilot chat from other ai plugins

It's only one day of work so for the moment I can authenticate, send a prompt and parse answer. That's all.

yeah thats cool, best of luck for the project 🤗

@chep
Copy link

chep commented Jul 9, 2024

I'm gonna need help for http stuff. My requests are very slow and sometimes I have empty answers. Does anyone knows how to use the url api ?

@chep
Copy link

chep commented Jul 10, 2024

Hi,
Chat is functional, with prompt buffer and shortcut functions (explain, doc, test…).
Feel free to test it, open issues and pull requests.

@TerminalFi
Copy link

@chep Wondering why you are not using the copilot.vim binary to interface with Copilot chat. Everything is already there to support chat. There is no need for you to implement it via API calls, etc. You can just use not LSP functions like the rest of the plugin to talk to Copilot chat.

Just beautify the file and you will see that everything is ready for you.

		e.set("conversation/preconditions", v6e),
		e.set("conversation/persistence", m6e),
		e.set("conversation/create", f6e),
		e.set("conversation/turn", E6e),
		e.set("conversation/turnDelete", w6e),
		e.set("conversation/destroy", d6e),
		e.set("conversation/rating", b6e),
		e.set("conversation/copyCode", e6e),
		e.set("conversation/insertCode", r6e),
		e.set("conversation/templates", T6e),
		e.set("conversation/agents", Y8e),

@chep
Copy link

chep commented Aug 1, 2024

@TerminalFi Because I used neovim copilot chat plugin which does not use the binary…

@knilink
Copy link

knilink commented Sep 25, 2024

made a clunky creaky poc here #343 to demonstrate how it could possible to chat through copilot.vim's language-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests