Skip to content

Commit

Permalink
Merge pull request #135 from andrewnguonly/1.0.11
Browse files Browse the repository at this point in the history
PR for app version `1.0.11`
  • Loading branch information
andrewnguonly authored Mar 14, 2024
2 parents 5c02dfd + bd13e65 commit a8d804a
Show file tree
Hide file tree
Showing 17 changed files with 953 additions and 486 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ If you don't have `npm` installed, you can download the pre-built extension pack
Right-click on the extension icon and select `Options` to access the extension's [Options page](https://developer.chrome.com/docs/extensions/develop/ui/options-page).

- **Ollama Model**: Select desired model (e.g. `llama2`)
- **Ollama Embedding Model**: Select desired embedding model (e.g. `nomic-embed-text`). **Caution**: Using a different embedding model requires Ollama to swap models, which may incur undesired latency in the app. This is a known limitation in Ollama and may be improved in the future.
- **Ollama Host**: Select desired host (defaults to `http://0.0.0.0:11434`)
- **Vector Store TTL (minutes)**: Number of minutes to store a URL's content in the vector store cache.
- **Content Parser Config**: Lumos's default content parser will extract all text content between a page's `<body></body>` tag. To customize the content parser, add an entry to the configuration.
Expand Down
54 changes: 54 additions & 0 deletions __tests__/contexts/ThemeContext.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @jest-environment jsdom
*/
import { render, act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import "@testing-library/jest-dom";
import {
ThemeProvider,
useThemeContext,
} from "../../src/contexts/ThemeContext";

const MockComponent = () => {
const { theme, toggleDarkMode } = useThemeContext();
return (
<div>
<span>Current Theme: {theme.palette.mode}</span>
<button onClick={toggleDarkMode}>Toggle Theme</button>
</div>
);
};

describe("ThemeProvider", () => {
it("toggles the theme from light to dark and back", async () => {
const mockGet = jest.fn().mockResolvedValue({ darkModeEnabled: false });
const mockSet = jest.fn();
/* eslint-disable @typescript-eslint/no-explicit-any */
global.chrome = {
storage: {
local: {
get: mockGet,
set: mockSet,
},
},
} as any;
/* eslint-enable @typescript-eslint/no-explicit-any */

const { findByText } = render(
<ThemeProvider>
<MockComponent />
</ThemeProvider>,
);

expect(await findByText(/Current Theme: light/i)).toBeInTheDocument();

const toggleButton = await findByText("Toggle Theme");
await act(async () => userEvent.click(toggleButton));

expect(await findByText(/Current Theme: dark/i)).toBeInTheDocument();

await act(async () => userEvent.click(toggleButton));

expect(await findByText(/Current Theme: light/i)).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.10",
"version": "1.0.11",
"manifest_version": 3,
"name": "Lumos",
"description": "An LLM co-pilot for browsing the web, powered by local LLMs. Your prompts never leave the browser.",
Expand Down
Loading

0 comments on commit a8d804a

Please sign in to comment.