Skip to content

Commit

Permalink
Added "Streaming Interval" option to reduce GUI lag
Browse files Browse the repository at this point in the history
  • Loading branch information
jukofyork committed Nov 30, 2024
1 parent 2d8f1de commit 7d0d231
Show file tree
Hide file tree
Showing 6 changed files with 760 additions and 734 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ private Constants() {

// The CSS and JS files we will load to initialise the browser.
public static final String[] CSS_FILENAMES = {
"main-style.css",
"code-block-header.css",
"code-block-style.css"
"main-style.css",
"code-block-header.css",
"code-block-style.css"
};
public static final String[] JS_FILENAMES = {
"mathjax/es5/tex-mml-chtml.js",
"highlight.min.js",
"inline-code-renderer.js",
"latex-renderer.js",
"get-selected-text.js"
"mathjax/es5/tex-mml-chtml.js",
"highlight.min.js",
"inline-code-renderer.js",
"latex-renderer.js",
"get-selected-text.js"
};

// Contains all highlight.js's supported languages and file extensions.
// See: https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
public static final String HIGHLIGHT_JS_LANGUAGES_FILENAMES = "language-extensions.json";

// Contains the model prices,context_window, etc.
// See: https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json
public static final String API_MODEL_DATA = "model_prices_and_context_window.json";
Expand All @@ -50,22 +50,22 @@ private Constants() {
public static final String DEFAULT_API_KEY = "<YOUR KEY HERE>";
public static final String MODEL_LIST_API_URL = "/models";
public static final String CHAT_COMPLETION_API_URL = "/chat/completions";

// Default bookmarked settings, showing 5 of the most common OpenAI compatible end-points.
public static final List<BookmarkedApiSettings> DEFAULT_BOOKMARKED_API_SETTINGS = new ArrayList<>(Arrays.asList(
new BookmarkedApiSettings("gpt-4-turbo", "https://api.openai.com/v1", "<YOUR API KEY>", 0.0),
new BookmarkedApiSettings("anthropic/claude-3.5-sonnet", "https://openrouter.ai/api/v1","<YOUR API KEY>", 0.0),
new BookmarkedApiSettings("<LLAMA.CPP MODEL NAME>", "http://localhost:8080/v1", "none", 0.0),
new BookmarkedApiSettings("<OLLAMA MODEL NAME>", "http://localhost:11434/v1", "none", 0.0),
new BookmarkedApiSettings("<TABBYAPI MODEL NAME>", "http://localhost:5000/v1", "none", 0.0)
));
new BookmarkedApiSettings("gpt-4-turbo", "https://api.openai.com/v1", "<YOUR API KEY>", 0.0),
new BookmarkedApiSettings("anthropic/claude-3.5-sonnet", "https://openrouter.ai/api/v1","<YOUR API KEY>", 0.0),
new BookmarkedApiSettings("<LLAMA.CPP MODEL NAME>", "http://localhost:8080/v1", "none", 0.0),
new BookmarkedApiSettings("<OLLAMA MODEL NAME>", "http://localhost:11434/v1", "none", 0.0),
new BookmarkedApiSettings("<TABBYAPI MODEL NAME>", "http://localhost:5000/v1", "none", 0.0)
));

// Widget dimensions and spacing for the main view.
public static final int DEFAULT_EXTERNAL_MARGINS = 0;
public static final int DEFAULT_INTERNAL_SPACING = 2;

// =============================================================================

// Connection timeout.
// NOTE: A short connection timeout stops the preference page from stalling.
public static final int MIN_CONNECTION_TIMEOUT = 1;
Expand All @@ -78,6 +78,11 @@ private Constants() {
public static final int MAX_REQUEST_TIMEOUT = Integer.MAX_VALUE;
public static final int DEFAULT_REQUEST_TIMEOUT = 300;

// The (minimum) update interval for use in processStreamingResponse() to avoid GUI stalling.
public static final int MIN_STREAMING_UPDATE_INTERVAL = 1;
public static final int MAX_STREAMING_UPDATE_INTERVAL = 1000;
public static final int DEFAULT_STREAMING_UPDATE_INTERVAL = 100;

// Temperature value.
// NOTE: Coding LLMs need a much lower (preferably zero) temperature vs chat LLMs.
public static final double MIN_TEMPERATURE = 0.0; // Zero temperature.
Expand Down
Loading

0 comments on commit 7d0d231

Please sign in to comment.