smallcloudai / refact-vscode

Refact AI: Open-source AI Code assistant with autocompletion, chat, refactoring and more for VS Code
https://refact.ai
BSD 3-Clause "New" or "Revised" License
61 stars 19 forks source link

Big chat upgrade (replaced by #36) #33

Closed Ahmadkhan02 closed 9 months ago

Ahmadkhan02 commented 10 months ago

/claim #28 done with most of the issue but the sidebar part. Do tell if something needs to be changes.

olegklimov commented 10 months ago

image

I see:

image

Ahmadkhan02 commented 10 months ago

image

I see:

  • syntax highlight
  • edit in place
  • history

image

also, 1)clicking anywhere on the chat will toggle autoscroll -> code can be copied while answer is streaming 2)diff, new file, copy are now available before streaming is finished. 3)and again on chat being on sidebar, that wouldnt work. Making another sidebar item on vscode primary sidebar will not allow new chat button or the newly added history to work. Also vscode will not allow direct opening of a secondary sidebar via code.

Can you please guide me towards what part of this pull request was dissatisfactory

olegklimov commented 10 months ago

Can you please guide me towards what part of this pull request was dissatisfactory

It's pretty good. CSS needs fixing, but that's minor. I'll have time to play with it more on Friday.

Ahmadkhan02 commented 10 months ago

@olegklimov After some research into sidebars in vscode, I learnt that all sidebar webviews are made via vscode.webviewViewProvider class. Hence I was able to bring chat to sidebar. Also added checks for login to it now as it is no longer dependent on the existing sidebar. Also did some css fixes.

olegklimov commented 10 months ago

Looking

olegklimov commented 10 months ago

@Ahmadkhan02 hi, one thing that makes your changes hard to work with: changed whitespace. In src/userLogin.ts there are 700 changed lines, and it's not clear what exactly changed. I'll try to fix it myself...

olegklimov commented 10 months ago

I'm trying to fix it in #35 , but it's hard. In src/extension.ts it looks like an automatic formatting tool was applied.

Ahmadkhan02 commented 10 months ago

I'm trying to fix it in #35 , but it's hard. In src/extension.ts it looks like an automatic formatting tool was applied.

I am sorry that that happened. I didnt think auto-formatting will end up in such a issues. Ill give the changes from extension.ts here again though for clarification.

//in imports +import ChatTab from "./chatTab";

//global variables declare global{ ... var chat_panel: ChatTab | undefined; ... }

//change to pressed_call_chat async function pressed_call_chat() { console.log(["pressed_call_chat"]); await vscode.commands.executeCommand("workbench.action.focusChatSideBar"); }

//addition to activate global.chat_panel = new ChatTab( context, new ChatHistoryProvider(context, global.user_logged_in), "" ); let chatView = vscode.window.registerWebviewViewProvider( "refactai-chatSidebar", global.chat_panel, { webviewOptions: { retainContextWhenHidden: true } } ); context.subscriptions.push(chatView);

olegklimov commented 10 months ago

The version that works for me the best is 3d5f0. All the later versions don't do anything if I press "New Chat".

It's not necessary to add another sidebar, that was just a simplification. Also any changes in files unrelated to chat can potentially result in merge conflicts with other branches -- it might become harder to merge.

I think at this point debugging 3d5f0 is the best way to proceed.

image

This needs some fixing: why two lines, one bold, one regular, why the first line cut early, second line isn't cut at all. "Back" and "x" don't look right.

image

Problems I found:

Ahmadkhan02 commented 10 months ago

The version that works for me the best is 3d5f0. All the later versions don't do anything if I press "New Chat". This does start a new chat in the Chat sidebar item for the later versions.

I think at this point debugging 3d5f0 is the best way to proceed.

  • I cannot continue the chat, it resets to empty each time I enter my phrase.
  • The highlighted code doesn't match dark blue theme.
  • Buttons "New File", "Copy" work before the answer is finished, but I still cannot scroll when the answer is generated.

Yes I have the solutions to these issues you mentioned from 3d5f0. But this new commit was the only method I say to have chat implemented on the sidebar. The extension.ts and userLogin.ts files needed to be touched though.

Even if we somehow do with a single sidebar, we would need to remove the entire chatTab.ts code and include it into sidebar.ts logic. This is not a very good approach though

Ahmadkhan02 commented 10 months ago

@olegklimov I have covered all these concerns in #36

ghost commented 9 months ago

@Ahmadkhan02 , @olegklimov , this one can be closed.