Skip to content

Conversation

@qdaxb
Copy link
Contributor

@qdaxb qdaxb commented Mar 13, 2025

Context

Currently, when adding a contetx to the chat window, the @file_path: format is used, which will activate the mention process and cause confusion in the model. This pr removes the @ and only keeps the file path

before:

**User:**

<task>
'README.md:' (see below for file content)
```
### Resources
- List and access notes via `note://` URIs
- Each note has a title, content and metadata
- Plain text mime type for simple content access
```explan this
</task>

<file_content path="README.md:">
Error fetching content: Failed to access path "README.md:": ENOENT: no such file or directory, stat '/Users/axb-mac/dev/aigc/test_ai_copilot/mcp_demo/echo-server/README.md:'
</file_content>
<environment_details>
...

after:

<task>
/README.md:
```
### Resources
- List and access notes via `note://` URI
- Each note has a title, content, and metadata
- Plain text MIME type for easy content access
```explan this
</task>
<environment_details>
...

Implementation

Screenshots

before after

How to Test

Get in Touch


Important

Remove '@' from file path in ADD_TO_CONTEXT template in support-prompt.ts to prevent mention activation.

  • Behavior:
    • Removes '@' from file path in ADD_TO_CONTEXT template in support-prompt.ts to prevent mention process activation.
  • Templates:
    • Updates template in ADD_TO_CONTEXT configuration to use /${filePath} instead of @/${filePath}.

This description was created by Ellipsis for b1216bad0096db59f91ca3e589eaf4cd76fe4f18. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2025

⚠️ No Changeset found

Latest commit: 5916a4d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 13, 2025
@samhvw8
Copy link
Contributor

samhvw8 commented Mar 13, 2025

hmm why Roo can add to context but Roo cannot get content of the file ?
btw you can change to content of template on Roo

@qdaxb
Copy link
Contributor Author

qdaxb commented Mar 13, 2025

hmm why Roo can add to context but Roo cannot get content of the file ?

If we remove the colon after the path, Roo can get the complete file content, but this may cause the context to be too long.

@samhvw8
Copy link
Contributor

samhvw8 commented Mar 13, 2025

hmm why Roo can add to context but Roo cannot get content of the file ?

If we remove the colon after the path, Roo can get the complete file content, but this may cause the context to be too long.

so i think we can make a space between file path and : to let Roo read file
for let roo read the necessary, because it may be long in 1 request but you not send it, Roo may request to read the file, and we will lost more context to it (because each request will have bunch of system prompt and previous message)

@qdaxb
Copy link
Contributor Author

qdaxb commented Mar 13, 2025

so i think we can make a space between file path and : to let Roo read file
for let roo read the necessary, because it may be long in 1 request but you not send it, Roo may request to read the file, and we will lost more context to it (because each request will have bunch of system prompt and previous message)

This may require a balance between sending the entire file at once and calling read_file in next request.
In some cases (such as interpreting a piece of code), the complete file content is not actually needed.

The current modification method is as consistent as possible with the previous version, except that the invalid prompt information is removed.

@samhvw8
Copy link
Contributor

samhvw8 commented Mar 13, 2025

so i think we can make a space between file path and : to let Roo read file
for let roo read the necessary, because it may be long in 1 request but you not send it, Roo may request to read the file, and we will lost more context to it (because each request will have bunch of system prompt and previous message)

This may require a balance between sending the entire file at once and calling read_file in next request. In some cases (such as interpreting a piece of code), the complete file content is not actually needed.

The current modification method is as consistent as possible with the previous version, except that the invalid prompt information is removed.

Why my experience, Even when you only want interpreting a piece of code, roo still request read the file :(, can you recheck that case ?

@samhvw8
Copy link
Contributor

samhvw8 commented Mar 13, 2025

but i think we can archive" interpreting a piece of code" by can add line number and add some other prompt to make it not read file again

@qdaxb
Copy link
Contributor Author

qdaxb commented Mar 13, 2025

so i think we can make a space between file path and : to let Roo read file
for let roo read the necessary, because it may be long in 1 request but you not send it, Roo may request to read the file, and we will lost more context to it (because each request will have bunch of system prompt and previous message)

This may require a balance between sending the entire file at once and calling read_file in next request. In some cases (such as interpreting a piece of code), the complete file content is not actually needed.
The current modification method is as consistent as possible with the previous version, except that the invalid prompt information is removed.

Why my experience, Even when you only want interpreting a piece of code, roo still request read the file :(, can you recheck that case ?

Depends on the specific task, such as this one

**User:**

<task>
/src/index.ts:
```
server.resource(
  "echo",
  new ResourceTemplate("echo://{message}", { list: undefined }),
  async (uri, { message }) => ({
    contents: [{
      uri: uri.href,
      text: `Resource echo: `
    }]
  })
);
```draw seq diagram
</task>
<environment_details>
# VSCode Visible Files
src/index.ts

# VSCode Open Tabs
src/index.ts

# Current Time
2025/3/13 下午5:35:44 (Asia/Shanghai, UTC+8:00)

# Current Context Size (Tokens)
(Not available)

# Current Mode
<slug>ask</slug>
<name>Ask</name>


NOTE: You are currently in 'Ask' mode, which does not allow write operations. To write files, the user will need to switch to a mode that supports file writing, such as 'Code' mode.

# Current Working Directory echo-server) Files
src/index.ts
</environment_details>

---

**Assistant:**

<thinking>
The user has provided a code snippet from src/index.ts and requested a sequence diagram. The code shows a server resource being created with an async handler. I need to analyze the code flow and create a sequence diagram that represents the interactions between the components.
</thinking>

Here is the sequence diagram in Mermaid format:

```mermaid
sequenceDiagram
    participant Client
    participant Server
    participant ResourceTemplate
    participant Handler

    Client->>Server: Request echo://{message}
    Server->>ResourceTemplate: Create resource
    ResourceTemplate-->>Server: Return template
    Server->>Handler: Invoke async handler with uri and message
    Handler->>Handler: Process request
    Handler-->>Server: Return response with contents
    Server-->>Client: Return response
```

This diagram shows:
1. The client sends a request to the server with a message
2. The server creates a resource using the ResourceTemplate
3. The async handler processes the request
4. The server returns the response to the client

The diagram captures the main interactions between the components in the code snippet.

---

@qdaxb qdaxb force-pushed the remove_at_when_add_context branch from b1216ba to 5916a4d Compare March 13, 2025 09:44
@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Mar 13, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 17, 2025
@cte cte merged commit 4f15b5d into RooCodeInc:main Mar 17, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants