Feature: Support chatting with multiple files (#306)

* Initial implementation

* Refactor UI related classes and organize imports

* Display selected files notification, include the files in the prompt

* feat: store referenced file paths in the messate state

* feat: add selected files accordion

* feat: update UI

* feat: improve file selection

* feat: support prompt template configuration

* fix: token calculation for virtualfile checkbox tree

* refactor: clean up

* refactor: move labels/descriptions to bundle
This commit is contained in:
Carl-Robert 2023-12-12 22:30:39 +02:00 committed by GitHub
parent 4354000ddb
commit f4be25bdac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 1125 additions and 148 deletions

View file

@ -0,0 +1,39 @@
package ee.carlrobert.codegpt.ui;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.ui.JBFont;
import ee.carlrobert.codegpt.Icons;
import ee.carlrobert.llm.client.openai.completion.OpenAIChatCompletionModel;
import java.util.NoSuchElementException;
import javax.swing.SwingConstants;
public class ModelIconLabel extends JBLabel {
public ModelIconLabel(String clientCode, String modelCode) {
if ("you.chat.completion".equals(clientCode)) {
setIcon(Icons.You);
return;
}
if ("chat.completion".equals(clientCode)) {
setIcon(Icons.OpenAI);
}
if ("azure.chat.completion".equals(clientCode)) {
setIcon(Icons.Azure);
}
if ("llama.chat.completion".equals(clientCode)) {
setIcon(Icons.Llama);
}
setText(formatModelName(modelCode));
setFont(JBFont.small());
setHorizontalAlignment(SwingConstants.LEADING);
}
private String formatModelName(String modelCode) {
try {
return OpenAIChatCompletionModel.findByCode(modelCode).getDescription();
} catch (NoSuchElementException e) {
return modelCode;
}
}
}