Skip to content

Commit e1905ae

Browse files
argshookRobitx
authored andcommitted
add config.chat_template to be able to customize the chat file banner
1 parent b4d35fd commit e1905ae

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lua/gp/config.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,20 @@ local config = {
281281
-- just a static string is legacy and the [{{agent}}] element is added automatically
282282
-- if you really want just a static string, make it a table with one element { "🤖:" }
283283
chat_assistant_prefix = { "🤖:", "[{{agent}}]" },
284+
-- The banner shown at the top of each chat file.
285+
chat_template = [[
286+
# topic: ?
287+
288+
- file: %s
289+
%s
290+
Write your queries after %s. Use `%s` or :%sChatRespond to generate a response.
291+
Response generation can be terminated by using `%s` or :%sChatStop command.
292+
Chats are saved automatically. To delete this chat, use `%s` or :%sChatDelete.
293+
Be cautious of very long chats. Start a fresh chat by using `%s` or :%sChatNew.
294+
295+
---
296+
297+
%s]],
284298
-- chat topic generation prompt
285299
chat_topic_gen_prompt = "Summarize the topic of our conversation above"
286300
.. " in two or three words. Respond only with those words.",

lua/gp/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,7 +2052,7 @@ M.new_chat = function(params, toggle, system_prompt, agent)
20522052
end
20532053

20542054
local template = string.format(
2055-
M.chat_template,
2055+
M.config.chat_template or M.chat_template,
20562056
string.match(filename, "([^/]+)$"),
20572057
model .. provider .. system_prompt,
20582058
M.config.chat_user_prefix,

0 commit comments

Comments
 (0)