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

Diff mode not working. #95

Open
LuciferMornens opened this issue Dec 13, 2024 · 10 comments
Open

Diff mode not working. #95

LuciferMornens opened this issue Dec 13, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@LuciferMornens
Copy link

Which API Provider are you using?

OpenRouter

Which Model are you using?

Claude 3.5 sonnet

What happened?

The diff mode is not working although selected in the experimental.

It still does whole mode (or whatever original cline was).

Steps to reproduce

  1. Open Roo Cline
  2. Openrouter/claude-3.5-sonnet
  3. Try to edit / code

Relevant API REQUEST output

No response

Additional context

No response

@LuciferMornens LuciferMornens added the bug Something isn't working label Dec 13, 2024
@mrubens
Copy link
Collaborator

mrubens commented Dec 13, 2024

@LuciferMornens what happens if you ask it to use the apply_diff tool when making edits?

@mrubens
Copy link
Collaborator

mrubens commented Dec 13, 2024

Reposting a comment that I made in Discord:

I was worried about the feedback from Saoud and others that diff editing would lead to lower quality code, so I intentionally added it as a new tool that the LLM can choose to use or not. (I gave it some guidance that the diff editing mattered more when the files are longer than 300 lines - maybe I should change that or make it configurable.) That said, if you ask in your task for the LLM to use the apply_diff tool for editing code I’ve found that it will listen.

@PierrunoYT
Copy link

Reposting a comment that I made in Discord:

I was worried about the feedback from Saoud and others that diff editing would lead to lower quality code, so I intentionally added it as a new tool that the LLM can choose to use or not. (I gave it some guidance that the diff editing mattered more when the files are longer than 300 lines - maybe I should change that or make it configurable.) That said, if you ask in your task for the LLM to use the apply_diff tool for editing code I’ve found that it will listen.

Yeah it should make diff also with less lines

@mrubens
Copy link
Collaborator

mrubens commented Dec 14, 2024

I think #107 will address this

@mrubens
Copy link
Collaborator

mrubens commented Dec 14, 2024

@LuciferMornens I just released 2.2.4 - can you try that and let me know if it works better for you?

@LuciferMornens
Copy link
Author

I will take a look!

@mrubens
Copy link
Collaborator

mrubens commented Dec 17, 2024

@LuciferMornens how's it looking? Can you test out 2.2.15?

@LuciferMornens
Copy link
Author

@mrubens hey. Been testing for like 20 minutes now with the latest update. Pretty cool so far, still gotta mention it to use apply diffs but that’s fine.

I like it handles when the changes are not similar but it eventually still gets stuck if too many edits to do.

For example if you keep iterating on an issue that you’re stuck at, the diff mode will only make it worse so I have to go with normal editing mode to fix it .

If that makes any sense

@ozeron
Copy link

ozeron commented Dec 17, 2024

I had the same issue, but for me, it manifested differently: The checkbox in the setting was not working, I was selecting use diffs, but it was using default mode. Thank you for fixing 🙌

@jeremy-returned
Copy link

@mrubens hey. Been testing for like 20 minutes now with the latest update. Pretty cool so far, still gotta mention it to use apply diffs but that’s fine.

I like it handles when the changes are not similar but it eventually still gets stuck if too many edits to do.

For example if you keep iterating on an issue that you’re stuck at, the diff mode will only make it worse so I have to go with normal editing mode to fix it .

If that makes any sense

This is true on 2.2.18 as well:

Unable to apply diff to file: \\wsl.localhost\Ubuntu\home\jbreturned\digossolar\backend\tests\test-install-types.js

<error_details>
Line range 279-310 is invalid (file has 247 lines)

Debug Info:
- Requested Range: lines 279-310
- File Bounds: lines 1-247
</error_details>

and

Unable to apply diff to file: \\wsl.localhost\Ubuntu\home\jbreturned\digossolar\backend\src\functions\install-types.ts

<error_details>
No sufficiently similar match found at start: 202 to end: 229 (47% similar, needs 100%)

Debug Info:
- Similarity Score: 47%
- Required Threshold: 100%
- Search Range: lines 202-229

Search Content:
const removeInstallTypeHandler: UnwrappedHandler = async (event) => {
    assertAuthenticated(event);
    try {
        const installTypeId = event.pathParameters?.id;
        if (!installTypeId) {
            return createResponse(400, 'Install type ID is required', true);
        }

        // Check if install type exists
        const [installType] = await event.db
            .select()
            .from(installTypes)
            .where(eq(installTypes.id, parseInt(installTypeId)));

        if (!installType) {
            return createResponse(404, 'Install type not found', true);
        }

        // Delete install type
        await event.db
            .delete(installTypes)
            .where(eq(installTypes.id, parseInt(installTypeId)));

        return createResponse(204, null);
    } catch (err) {
        return handleDatabaseError(err);
    }
};

Best Match Found:
182 |     assertAuthenticated(event);
183 |     try {
184 |         const installTypeId = event.pathParameters?.id;
185 |         
186 |         // Get specific install type if ID is provided
187 |         if (installTypeId) {
188 |             const [installType] = await event.db
189 |                 .select()
190 |                 .from(installTypes)
191 |                 .where(eq(installTypes.id, parseInt(installTypeId)));
192 | 
193 |             if (!installType) {
194 |                 return createResponse(404, 'Install type not found', true);
195 |             }
196 | 
197 |             // Get equipment for this install type
198 |             const equipment = await event.db
199 |                 .select()
200 |                 .from(installTypeEquipment)
201 |                 .where(eq(installTypeEquipment.installTypeId, installType.id));
202 | 
203 |             return createResponse(200, {
204 |                 ...installType,
205 |                 basePrice: installType.basePrice.toString(),
206 |                 laborHours: installType.laborHours.toString(),
207 |                 equipment: equipment.map(e => ({
208 |                     type: e.type,
209 |                     itemId: e.itemId,

Original Content:
182 |     assertAuthenticated(event);
183 |     try {
184 |         const installTypeId = event.pathParameters?.id;
185 |         
186 |         // Get specific install type if ID is provided
187 |         if (installTypeId) {
188 |             const [installType] = await event.db
189 |                 .select()
190 |                 .from(installTypes)
191 |                 .where(eq(installTypes.id, parseInt(installTypeId)));
192 | 
193 |             if (!installType) {
194 |                 return createResponse(404, 'Install type not found', true);
195 |             }
196 | 
197 |             // Get equipment for this install type
198 |             const equipment = await event.db
199 |                 .select()
200 |                 .from(installTypeEquipment)
201 |                 .where(eq(installTypeEquipment.installTypeId, installType.id));
202 | 
203 |             return createResponse(200, {
204 |                 ...installType,
205 |                 basePrice: installType.basePrice.toString(),
206 |                 laborHours: installType.laborHours.toString(),
207 |                 equipment: equipment.map(e => ({
208 |                     type: e.type,
209 |                     itemId: e.itemId,
210 |                     quantity: e.quantity
211 |                 }))
212 |             });
213 |         }
214 | 
215 |         // Get all install types
216 |         const allInstallTypes = await event.db
217 |             .select()
218 |             .from(installTypes)
219 |             .orderBy(asc(installTypes.name));
220 | 
221 |         // Get equipment for all install types
222 |         const equipment = await event.db
223 |             .select()
224 |             .from(installTypeEquipment);
225 | 
226 |         // Map equipment to install types
227 |         const mappedInstallTypes = allInstallTypes.map((it: InstallType) => ({
228 |             ...it,
229 |             basePrice: it.basePrice.toString(),
230 |             laborHours: it.laborHours.toString(),
231 |             equipment: equipment
232 |                 .filter(e => e.installTypeId === it.id)
233 |                 .map(e => ({
234 |                     type: e.type,
235 |                     itemId: e.itemId,
236 |                     quantity: e.quantity
237 |                 }))
238 |         }));
239 | 
240 |         return createResponse(200, mappedInstallTypes);
241 |     } catch (err) {
242 |         return handleDatabaseError(err);
243 |     }
244 | };
245 | 
246 | const removeInstallTypeHandler: UnwrappedHandler = async (event) => {
247 |     assertAuthenticated(event);
248 |     try {
249 |         const installTypeId = event.pathParameters?.id;
</error_details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants