Skip to content

Only First File Collected by Globbing is Sent to the API #1451

Description

@sempervictus

Describe the bug
aichat is not properly sending the contents of files collected by shell globbing:

Details
$ aichat  --file src/*rs show the names of the files provided then show the ones which have content and the ones which dont
We are given three file paths: `src/function.rs`, `src/main.rs`, `src/serve.rs`, and also a file `src/cli.rs` which is shown in the content.

However, the user's request is:
1. Show the names of the files provided.
2. Then show which ones have content and which ones don't.

But note: the user provided the content of `src/cli.rs` and listed three other files (without content). So we have:

Files provided (by name) in the user's message:
- `src/function.rs`
- `src/main.rs`
- `src/serve.rs`
- `src/cli.rs` (with content)

But note: the user said "src/function.rs src/main.rs src/serve.rs" and then showed `src/cli.rs` content.

So the files we are to evaluate are:
- `src/function.rs`
- `src/main.rs`
- `src/serve.rs`
- `src/cli.rs` (which we have content for)

However, the user did not provide content for `src/function.rs`, `src/main.rs`, or `src/serve.rs` — they only provided the content for `src/cli.rs`.

Therefore, we can only say that `src/cli.rs` has content (as we see it), and the other three are listed but without content.

But note: the user says "show the names of the files provided then show the ones which have content and the ones dont".

So let's break it down:

### Step 1: List the names of the files provided
The user provided the names:
- `src/function.rs`
- `src/main.rs`
- `src/serve.rs`
- `src/cli.rs` (and also provided its content)

But note: the user's message started with "src/function.rs src/main.rs src/serve.rs" and then showed `src/cli.rs` content. So all four are mentioned.

### Step 2: Determine which have content and which don't
- `src/cli.rs`: has content (we see the entire file)
- `src/function.rs`: no content provided (only the name)
- `src/main.rs`: no content provided
- `src/serve.rs`: no content provided

So:

### Summary:

**Files provided (by name):**
- src/function.rs
- src/main.rs
- src/serve.rs
- src/cli.rs

**Files with content:**
- src/cli.rs

**Files without content:**
- src/function.rs
- src/main.rs
- src/serve.rs

To Reproduce

aichat --file src/*rs show the names of the files provided then show the ones which have content and the ones which dont in the root of the project

Expected behavior

4 rust files passed to the LLM in the chat context

Logs

Screenshots

Configuration

Environment (please complete the following information):

  • os version: arch rolling
  • aichat version: current HEAD
  • terminal version: various terminals, mostly gnome shell

Additional context
Tested against several inference frameworks and LLMs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions