GithubHelp home page GithubHelp logo

vscode-fauxpilot's Introduction

Visual Studio Code - Fauxpilot Client

GitHub contributors Forks Stars GitHub issues License Test

Please be aware! For this extension to work you have to set up Fauxpilot server by @moyix

Development

Copied from VSC extension guidelines

What's in the folder

  • This folder contains all of the files necessary for your extension.
  • package.json - this is the manifest file in which you declare your extension and command.
    • The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
  • src/extension.ts - this is the main file where you will provide the implementation of your command.
    • The file exports one function, activate, which is called the very first time your extension is activated (in this case by executing the command). Inside the activate function we call registerCommand.
    • We pass the function containing the implementation of the command as the second parameter to registerCommand.

Setup

  • install the recommended extensions (amodio.tsl-problem-matcher and dbaeumer.vscode-eslint)

Get up and running straight away

  • Press F5 to open a new window with your extension loaded.
  • Run your command from the command palette by pressing (Ctrl+Shift+P or Cmd+Shift+P on Mac) and typing Hello World.
  • Set breakpoints in your code inside src/extension.ts to debug your extension.
  • Find output from your extension in the debug console.

Make changes

  • You can relaunch the extension from the debug toolbar after changing code in src/extension.ts.
  • You can also reload (Ctrl+R or Cmd+R on Mac) the VS Code window with your extension to load your changes.

Explore the API

  • You can open the full set of our API when you open the file node_modules/@types/vscode/index.d.ts.

Run tests

  • Open the debug viewlet (Ctrl+Shift+D or Cmd+Shift+D on Mac) and from the launch configuration dropdown pick Extension Tests.
  • Press F5 to run the tests in a new window with your extension loaded.
  • See the output of the test result in the debug console.
  • Make changes to src/test/suite/extension.test.ts or create new test files inside the test/suite folder.
    • The provided test runner will only consider files matching the name pattern **.test.ts.
    • You can create folders inside the test folder to structure your tests any way you want.

Go further

Acknowledgements

Inspired & used snippets from:

Client is build around Fauxpilot server

vscode-fauxpilot's People

Contributors

aincvy avatar asapelkin avatar frederisk avatar luanshaotong avatar ravenscroftj avatar venthe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-fauxpilot's Issues

Option to switch to Fauxpilot "python-backend" by making "model" configurable.

In the newer fauxpilot there is also a "py-model", next to "fastertransformer" backend, which enables deployment on low-resource devices (using int8 / float16 support etc.)

To use it, "py-model" would need to be configurable.

See in:

return this.openai.createCompletion({
model: "fastertransformer",

this could be changed to:

return this.openai.createCompletion({
            model: workspace.getConfiguration('fauxpilot').get("model"),
            ....

And make it configurable, e.g. here:

"fauxpilot.maxLines": {
"type": "number",
"default": 150

Cannot enable FauxPilot

I put the repo folder in %userprofile%/.vscode/faux

It shows up, but I can't CTRL + P > Enable FauxPilot. I get:
image

Tried installing from marketplace.... same issue..........

Version: 1.77.3 (user setup)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:02.548Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: No

Error when connecting to TLS-enabled endpoint

Hi there,

The extension is great! It works well with an HTTP endpoint.

However, I'm hosting the Fauxpilot server in the cloud and I need to access it via HTTPS. I can use the following curl request to get a 200 response and code completions:

curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"prompt":"def hello","max_tokens":100,"temperature":0.1,"stop":["\n\n"]}' https://my-server-hostname:8443v1/engines/codegen/completions

I took that curl command from the Fauxpilot server docs. I get back this:

{
  "id": "cmpl-ynnnfHJDCfyPTxN1nk5zBGqsblhwQ",
  "model": "codegen",
  "object": "text_completion",
  "created": 1702502561,
  "choices": [
    {
      "text": "(self):\n        return \"Hello World!\"",
      "index": 0,
      "finish_reason": "stop",
      "logprobs": null
    }
  ],
  "usage": {
    "completion_tokens": 11,
    "prompt_tokens": 2,
    "total_tokens": 13
  }
}

When I try to use this VSCode extension, though, the Fauxpilot spinner in the bottom right keeps spinning, and this is printed in the logs:

2023-12-13 16:16:46.850 [error] [Venthe.fauxpilot] provider FAILED
2023-12-13 16:16:46.850 [error] Error: Connection error.
	at m.makeRequest (/Users/nick/.vscode/extensions/venthe.fauxpilot-1.2.0/dist/extension.js:11713:23)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async K.provideInlineCompletions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:143:56159)

I don't see any request logs in the TLS-terminating reverse proxy on my server.

Does the extension support TLS?

Completion is not working if `scheme` is `untitiled`

{ pattern: "**", scheme: 'untitled' }, new FauxpilotCompletionProvider()

I have tested behavior of that parameter and if you

  • specify scheme: 'untitled' the completition works only for new files, that is not saved on disk at this moment
  • specify scheme: 'file'the completition works only for files, that already saved on the disk.

May be we just remove that parameter as it was in v0.0.1 ?

[FeatureRequest] Prefer to use established connection

Appears there will be a [SYN] at the beginning of each inquiry are made, and [FIN] after it.
This is acceptable when communicating locally directly on the server.

But when we rent a server and would like to setup a nginx and perform such inquiries under TLS, such SYN, FIN action will cause tons of handshakes and overheads eventually cause performance issues.

I wish the connection logic could be adjusted to only make one SYN and keep using this the connection until FIN is a must.

image

Fauxpilot uses only the first line of completion, not all available lines

Using code like this:

import sys
import socket

# function to create a socket and connect to the specified IP:port

If I manually request a completion using cURL I see that the returned JSON includes multi-line completion.

Request:

curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST --data-binary @r http://192.168.0.127:5000/v1/engines/codegen/completions | jq

Response:

{
  "id": "cmpl-rcvc6Jwx9k0g4leFHnSuhNorjA5p2",
  "model": "codegen",
  "object": "text_completion",
  "created": 1697647739,
  "choices": [
    {
      "text": "def connect(ip, port):\n   s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n   s.connect((ip, port))\n   return s\n# function to send a string to the socket\ndef send(s, message):\n   s.send(message)\n# function to receive a string from the socket\ndef recv(s):\n   return s.recv(1024)\n# function",
      "index": 0,
      "finish_reason": "length",
      "logprobs": null
    }
  ],
  "usage": {
    "completion_tokens": 100,
    "prompt_tokens": 33,
    "total_tokens": 133
  }
}

We can see the completion returned a whole function:

def connect(ip, port):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((ip, port))
    return s

However, when we do this inside VS Code using the Fauxpilot extension we are only ever presented with the first line of the completion, which in this case is def connect(ip, port): and nothing else. I have verified that the Fauxpilot extension is receiving multi-line completions from the Fauxpilot server (I used tcpdump to watch the HTTP traffic) but is silently dropping everything but the first line.

It would be much more useful if the first completion option was the full multi-line response so that the user could simply hit tab once and have an entire function auto-complete from Fauxpilot.

Instead the user has to do a repeated cycle of: hit tab; hit enter; wait 150ms; hit tab; hit enter; wait 150ms.... rinse and repeat until all completion lines are done.

Can we have multi-line completion please? Thanks!

feature request: removing extra parentheses

whenever vscode inserts a parentheses pair, the AI model will often put its own parentheses, disregarding the ones that VSCode put in

image

thus the extension could remove extra parentheses, brackets etc

Install Guide

The requirements for this plugin aren't obvious. I have Fauxpilot running. For this extension to work do you first need the copilot extension installed?

400 Bad Request when file has around 100 lines of code

Is there a way to configure the max lines/tokens or other configuration to fix the 400 I am getting on medium size files? I have tried increasing/decreasing the max lines and max tokens in the extension settings but that did not work. This happens with different model choices. I have restarted vscode between changes.

Issue Description

When the source file or java unit test file grows to 120 lines or so of code, my 200 OK become 400 Bad Request

fauxpilot-copilot_proxy-1  | INFO:     2023-06-13 19:50:41,149 :: 172.29.198.78:55171 - "POST /v1/engines/codegen/completions HTTP/1.1" 200 OK
fauxpilot-copilot_proxy-1  | 1
fauxpilot-copilot_proxy-1  | INFO:     2023-06-13 19:51:02,653 :: 172.29.198.78:55176 - "POST /v1/engines/codegen/completions HTTP/1.1" 400 Bad Request

Expected Result

200 Ok with response

How to Reproduce

  1. When src or test file grows to 150 lines
  2. See error: "POST /v1/engines/codegen/completions HTTP/1.1" 400 Bad Request

Does not send request to code server.

I am trying to run it with turpopilot. I have turpopilot server running, and have configured fauxpilot to use it. But It does not work. I do not see any network packet going out to my turbopilot server

Delay or keybindings

Thanks for extension. But current behavior like "load testing". Because every entered symbol generates a query to the model, even If I haven't finished enter word. And so "ping" just increases.

Can we control requests to model may be with keybindings ? Or may be after some delay after last symbol was entered ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.