continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
19.65k stars 1.72k forks source link

Have a in project `config.json` #792

Open samuelint opened 10 months ago

samuelint commented 10 months ago

Validations

Problem

Solution

sestinj commented 10 months ago

@samuelint It was a small experiment at first so I just haven't added to the docs, but you can use a file titled .continuerc.json in the root of your VS Code workspace, and it will be merged with your main config.json (code here). Currently it will look at the root of all workspace directories in VS Code.

Something similar for config.ts doesn't yet exist, but I like your suggestion and can definitely make it happen.

When you suggest module.exports, do you mean that it should return a partial version of the configuration object, and then any manipulation logic just lives above at the top level of the file?

samuelint commented 10 months ago

By module.exports, I mean to have a single config file which contains content of config.json & config.ts.

Something like

module.exports = {
 models: [
    {
      model: "gpt-4-1106-preview",
      title: "GPT-4 Turbo",
      promptTemplate: {
          edit: () => {
             return `My own context {{language}}{{code}}.....`
         }
      }
      // etc...
    }
  ],
};

or

module.exports = (config:Config) => ({ ...config, myCustomStuff})

In both cases, content override the one set in ~/.continue


Btw I would be honoured to contribute for this.

sestinj commented 9 months ago

@samuelint sorry for taking 3 weeks to get back : / For the main config file we want to allow for something fully serializable so that we can write back to it, but we don't need to write back to .continuerc.json so it may actually make sense to do what you're describing in its place

One thing we would have to make sure to do is get types in the file. Possibly there's a way to do this through VS Code? We currently get types in config.ts by using a tsconfig.json and node_modules/@types, but I wouldn't want to deposit this in everybody's repo. If you were willing to look into this, it seems like a direction worth considering