continue icon indicating copy to clipboard operation
continue copied to clipboard

Have a in project `config.json`

Open samuelint opened this issue 1 year ago • 3 comments

Validations

  • [X] I believe this is a way to improve. I'll try to join the Continue Discord for questions
  • [X] I'm not able to find an open issue that requests the same enhancement

Problem

  • If I customize the config (set custom template, custom commands, etc), Teammates need to do the same on their machine.
  • Projects need different context based on their content. For example, a project might be in Typescript, another terraform. Some terraform projects are on GCP, other on AWS. Etc.. Would be nice to have answers based on a project custom context.

Solution

  • Have a .continuerc.js (or .continuerc.ts) or .continue.json located at the root of a project. Merge the config with ~/.continue/config.json and prioritize the project config.
  • .continuerc.js could use module.exports = {} instead of exporting modifyConfig . It would be more mainstream with other libraries of the community. Example of community project using module exports
    • eslint (eslintrc.js)
    • jest (jest.config.js)
  • Support VSCode workspaces. Use the .continuerc.js in the workspace of the current opened file.

samuelint avatar Jan 31 '24 00:01 samuelint

@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?

sestinj avatar Jan 31 '24 04:01 sestinj

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.

samuelint avatar Feb 01 '24 23:02 samuelint

@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

sestinj avatar Feb 19 '24 23:02 sestinj