mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Handle file names appropriately for md files and render commits in github results
This commit is contained in:
parent
dbe713604d
commit
dac2d14380
2 changed files with 5 additions and 3 deletions
|
@ -70,7 +70,8 @@
|
|||
} else if (
|
||||
item.additional.file.endsWith(".md") ||
|
||||
item.additional.file.endsWith(".markdown") ||
|
||||
(item.additional.file.includes("issues") && item.additional.file.includes("github.com"))
|
||||
(item.additional.file.includes("issues") && item.additional.file.includes("github.com")) ||
|
||||
(item.additional.file.includes("commit") && item.additional.file.includes("github.com"))
|
||||
)
|
||||
{
|
||||
html += render_markdown(query, [item]);
|
||||
|
|
|
@ -147,12 +147,13 @@ class MarkdownToJsonl(TextToJsonl):
|
|||
if type(raw_filename) == str and re.search(r"^https?://", raw_filename):
|
||||
entry_filename = raw_filename
|
||||
else:
|
||||
entry_filename = Path(raw_filename)
|
||||
entry_filename = str(Path(raw_filename))
|
||||
stem = Path(raw_filename).stem
|
||||
|
||||
heading = parsed_entry.splitlines()[0] if re.search("^#+\s", parsed_entry) else ""
|
||||
# Append base filename to compiled entry for context to model
|
||||
# Increment heading level for heading entries and make filename as its top level heading
|
||||
prefix = f"# {entry_filename.stem}\n#" if heading else f"# {entry_filename.stem}\n"
|
||||
prefix = f"# {stem}\n#" if heading else f"# {stem}\n"
|
||||
compiled_entry = f"{prefix}{parsed_entry}"
|
||||
entries.append(
|
||||
Entry(
|
||||
|
|
Loading…
Add table
Reference in a new issue