Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prompts): include default prompts in crate #174

Merged
merged 2 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions swiftide/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "Blazing fast, streaming document and code indexation"
categories = ["asynchronous"]
repository = "https://github.com/bosun-ai/swiftide-rs"
homepage = "https://swiftide.rs"
include = ["/**/*.prompt.md"]

[badges]

Expand Down
9 changes: 4 additions & 5 deletions swiftide/src/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ use crate::ingestion::Node;
lazy_static! {
/// Tera repository for templates
pub static ref TEMPLATE_REPOSITORY: RwLock<Tera> = {
let path = "./src/transformers/prompts/**/*.prompt.md";
let prefix = env!("CARGO_MANIFEST_DIR");
let path = format!("{prefix}/src/transformers/prompts/**/*.prompt.md");

match Tera::new(path).and_then(|mut t| {
t.extend(&Tera::new("swiftide/src/transformers/prompts/*.prompt.md")?)?;
Ok(t)
}) {
match Tera::new(&path)
{
Ok(t) => RwLock::new(t),
Err(e) => {
tracing::error!("Parsing error(s): {e}");
Expand Down