Skip to content

Commit

Permalink
ui/src/routes/+layout.js: removed ssr = false line; TerminalWidget.sv…
Browse files Browse the repository at this point in the history
…elte: import xterm and xterm-addon-fit on onMount(); ControlPanel.svelte: moved localStorage stuff into onMount()
  • Loading branch information
TheoIsDumb authored and 123vivekr committed Mar 24, 2024
1 parent c3605df commit 9f123c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
7 changes: 5 additions & 2 deletions ui/src/lib/components/ControlPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { projectList, modelList, internet } from "$lib/store";
import { createProject, fetchProjectList, getTokenUsage } from "$lib/api";
let selectedProject = localStorage.getItem("selectedProject") || "Select Project";
let selectedModel = localStorage.getItem("selectedModel") || "Select Model";
let selectedProject;
let selectedModel;
let tokenUsage = 0;
async function updateTokenUsage() {
Expand Down Expand Up @@ -54,6 +54,9 @@
onMount(() => {
setInterval(updateTokenUsage, 1000);
selectedProject = localStorage.getItem("selectedProject") || "Select Project";
selectedModel = localStorage.getItem("selectedModel") || "Select Model";
document
.getElementById("project-button")
.addEventListener("click", function () {
Expand Down
14 changes: 8 additions & 6 deletions ui/src/lib/components/TerminalWidget.svelte
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<script>
import { onMount } from "svelte";
import { Terminal } from "xterm";
import "xterm/css/xterm.css";
import { FitAddon } from "xterm-addon-fit";
import { agentState } from "$lib/store";
let terminalElement;
let terminal;
let fitAddon;
onMount(() => {
terminal = new Terminal({
onMount(async () => {
let xterm = await import('xterm');
let xtermAddonFit = await('xterm-addon-fit')
terminal = new xterm.Terminal({
disableStdin: true,
cursorBlink: true,
convertEol: true,
rows: 1,
});
fitAddon = new FitAddon();
fitAddon = new xtermAddonFit.FitAddon();
terminal.loadAddon(fitAddon);
terminal.open(terminalElement);
fitAddon.fit();
Expand Down Expand Up @@ -99,4 +101,4 @@
background: #4337c9;
border-radius: 10px;
}
</style>
</style>
1 change: 0 additions & 1 deletion ui/src/routes/+layout.js
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
export const ssr = false

0 comments on commit 9f123c3

Please sign in to comment.