leona / helix-gpt

Code assistant language server for Helix with support for Copilot/OpenAI/Codeium/Ollama
MIT License
285 stars 19 forks source link

Allow fully customizing system and user message #56

Open justinlovinger opened 2 months ago

justinlovinger commented 2 months ago

The system-message can be partially customized using options like --ollamaContext. However, a portion of the system-message and all the user-message is hard-coded, https://github.com/leona/helix-gpt/blob/master/src/providers/ollama.ts#L68. The hard-coded messages work poorly for some models and use-cases.

How about, instead of,

config.ollamaContext?.replace("<languageId>", languageId) + "\n\n" + `End of file context:\n\n${contents.contentAfter}`

for the system-message, and,

`Start of file context:\n\n${contents.contentBefore}`

for the user-message, something like, config.ollamaSystemMessage?.replace("<languageId>", languageId).replace("<contentBefore>", contents.contentBefore).replace("<contentAfter>", contents.contentAfter) for the system-message, and config.ollamaUserMessage?.replace("<languageId>", languageId).replace("<contentBefore>", contents.contentBefore).replace("<contentAfter>", contents.contentAfter) for the user-message. The default messages can still be the same, and users can still create the same messages as before, but this allows greater customization.

P.S. It would be nice to similarly customize chat-messages. However, that may be better handled by fully customizing actions.