Skip to content

Commit

Permalink
add config.chat_template to be able to customize the chat file banner
Browse files Browse the repository at this point in the history
  • Loading branch information
argshook committed Mar 13, 2024
1 parent d76be3d commit 0b6fc73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lua/gp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ local config = {
-- just a static string is legacy and the [{{agent}}] element is added automatically
-- if you really want just a static string, make it a table with one element { "🤖:" }
chat_assistant_prefix = { "🤖:", "[{{agent}}]" },
-- The banner shown at the top of each chat file.
chat_template = [[
# topic: ?
- file: %s
%s
Write your queries after %s. Use `%s` or :%sChatRespond to generate a response.
Response generation can be terminated by using `%s` or :%sChatStop command.
Chats are saved automatically. To delete this chat, use `%s` or :%sChatDelete.
Be cautious of very long chats. Start a fresh chat by using `%s` or :%sChatNew.
---
%s]],
-- chat topic generation prompt
chat_topic_gen_prompt = "Summarize the topic of our conversation above"
.. " in two or three words. Respond only with those words.",
Expand Down
2 changes: 1 addition & 1 deletion lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ M.new_chat = function(params, model, system_prompt, toggle)
end

local template = string.format(
M.chat_template,
M.config.chat_template or M.chat_template,
string.match(filename, "([^/]+)$"),
model .. system_prompt,
M.config.chat_user_prefix,
Expand Down

0 comments on commit 0b6fc73

Please sign in to comment.