OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Question]: How to preserve original filename/path after upload?

Open kc613910 opened this issue 2 months ago • 4 comments

Issue Origin

Observed or reproduced in a real environment

Your Question

Hi,

I’m using OpenViking, and I noticed that when a file is uploaded, it appears to be converted into a .md file.

Because of this conversion, the original filename and file path seem to be lost. As a result, the bot cannot reliably indicate where the original file came from.

Would it be possible for OpenViking to:

  1. Return the original file location

    • Return the original full filename, including its extension, together with the original file path.
    • For example: /path/to/original-file.pdf.
  2. Reference or surface the original file in chat

    • For example, if the uploaded file is a PDF, it would be helpful for the bot to reference or present the original PDF instead of only referring to the converted Markdown version.

Current behavior

Currently, uploaded files seem to be converted to .md, and the original filename/path does not appear to be preserved. Because of this, the bot cannot determine or return where the original file was found.

Question

What is the easiest way to achieve this without writing extra code?

Specifically:

  • Is there a built-in way to preserve or store the original filename and path?
  • Can OpenViking keep a reference to the original uploaded file after conversion?
  • Is there a configuration option that allows the bot to return the original file path?
  • If this is not fully possible without code, what is the minimal or no-code workaround?

Any guidance would be appreciated. Thanks!

Context

No response

Code Example (Optional)


Related Area

None

Before Asking

kc613910 avatar Sep 08 '26 07:09 kc613910

Thanks for the question.

Current behavior: OpenViking can preserve the uploaded filename (for example original-file.pdf), but it does not automatically preserve the client's full local path such as /path/to/original-file.pdf. For local uploads, the server receives the file bytes and filename, not the user machine's absolute path.

There is no config option today that makes the bot automatically return the original local path or the original PDF path after conversion.

The simplest no-code workaround is to put that information into the resource target or description when adding the file:

add_resource(
    path="/path/to/original-file.pdf",
    to="viking://resources/uploads/original-file",
    description="Original file: /path/to/original-file.pdf"
)

If the file has a stable remote URL, prefer adding that URL directly. That gives OpenViking a durable source reference the bot can cite.

sponge225 avatar Sep 08 '26 09:09 sponge225

Hi,

Thanks for the response and the workaround suggestions!

I tried implementing them but ran into a few roadblocks:

  1. The add_resource API doesn't actually have a description parameter in its signature.
  2. Passing the filepath via the reason or instruction fields didn't work — the bot still can't recall the original path when asked.
  3. Uploading via remote URL also didn't retain the original URL. The response JSON only shows temp paths (source_path, temp_uri) with no trace of the remote source.

Two follow-up questions:

  • If I embed the original filepath as metadata directly into the file itself, will it be preserved through the L0 Abstract and L1 Overview layers so the bot can still access and cite it?
  • If custom code is needed, what's the recommended approach? I was thinking of uploading a companion JSON file alongside each resource that records the original source path — would that work, or is there a better pattern?

Thanks again for your help!

kc613910 avatar Sep 09 '26 06:09 kc613910

Thanks for the follow-up, and you are right.

First, I need to correct my previous suggestion: the Python/REST add_resource API does not have a description parameter. The available field is reason. The MCP tool has a description argument, but it is mapped internally to reason.

For your questions:

  1. Embedding the original filepath inside the file itself may make it searchable, but it is not guaranteed to be preserved through L0 Abstract or L1 Overview. Those layers are generated summaries, not a metadata-preservation mechanism, so the model may omit the filepath if it does not consider it important. If you need reliable citation of the original path, do not rely on L0/L1 to carry it.

  2. A companion JSON/Markdown manifest would work as a no-code workaround, especially if it is plain and explicit. For example, add a small file next to the resource:

# Source manifest

Resource: viking://resources/uploads/original-file
Original source path: /path/to/original-file.pdf
Original filename: original-file.pdf

Markdown is usually easier for retrieval than JSON. If custom code is acceptable, the better long-term pattern is first-class source metadata: add an original_source_path / source_url field during resource ingestion, persist it with the resource, and return it in search/chat citations. That is more reliable than using reason, instruction, or generated summaries.

sponge225 avatar Sep 09 '26 07:09 sponge225

Thanks for the question and for catching the incorrect description example earlier. For local uploads, the SDK sends the filename and file contents, not the client's absolute path. Converting the document cannot recover a local path that the server never received.

reason and instruction guide processing, and L0/L1 are generated summaries; none guarantees preservation of a source path for citations. Current URL ingestion carries the original URL as source information, but this does not automatically make a bot cite it or present the original PDF.

Closing this usage question with those boundaries clarified. Automatic original-file presentation and reliable source citations are additional capabilities, and we are not planning to add them under this issue.

qin-ctx avatar Sep 10 '26 13:09 qin-ctx