feat: memory 🧠 (#793)

This commit is contained in:
yetone
2024-11-04 16:20:28 +08:00
committed by GitHub
parent 579ef12f76
commit 1e8abbf798
13 changed files with 197 additions and 154 deletions

View File

@@ -19,13 +19,11 @@ impl<'a> State<'a> {
struct TemplateContext {
use_xml_format: bool,
ask: bool,
question: String,
code_lang: String,
filepath: String,
file_content: String,
selected_code: Option<String>,
project_context: Option<String>,
memory_context: Option<String>,
}
// Given the file name registered after add, the context table in Lua, resulted in a formatted
@@ -44,13 +42,11 @@ fn render(state: &State, template: &str, context: TemplateContext) -> LuaResult<
.render(context! {
use_xml_format => context.use_xml_format,
ask => context.ask,
question => context.question,
code_lang => context.code_lang,
filepath => context.filepath,
file_content => context.file_content,
selected_code => context.selected_code,
project_context => context.project_context,
memory_context => context.memory_context,
})
.map_err(LuaError::external)
.unwrap())