Giter VIP home page Giter VIP logo

hollama's Introduction

Hollama

A minimal web-UI for talking to Ollama servers.

Features

  • Large prompt fields with code editor features
  • Markdown parsing w/syntax highlighting
  • Easily copy markdown as raw text
  • Customizable system prompts
  • Saves all changes on your browser's localStorage
  • Desktop & mobile friendly layout
  • Light & dark themes
  • Retryable completions
  • Streams completions

Live demo

Tip

The latest version of Hollama is available at: https://hollama.fernando.is

No sign up is required and data is 100% stored locally on your browser.

session knowledge session-new settings

Self-host (Docker)

To host your own Hollama server, install Docker and run the command below in your favorite terminal:

docker run --rm -d -p 4173:4173 ghcr.io/fmaclen/hollama:latest 

Then visit http://localhost:4173.

Connecting to an Ollama server

If you are using the publicly hosted version or your Docker server is on a separate device than the Ollama server you'll have to set the domain in OLLAMA_ORIGINS. Learn more in Ollama's docs.

OLLAMA_ORIGINS=https://hollama.fernando.is ollama serve

Developing

Install dependencies with npm install, start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

hollama's People

Contributors

fmaclen avatar gregomac1 avatar seanavers avatar web2ls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hollama's Issues

"Run" button should be disabled if the server is disconnected, no model is chosen or has no prompt

  • The existing button is located in sessions/[id]/+page.svelte
  • Right now it's only disabled if it has !prompt
  • The only server check we do is in the Settings view and the server status not globally available.
  • This is the current Typescript definition of Settings.
  • We could probably save the server status to the settingsStore so we can access it from the Sessions view.
  • Currently, we only check the status of the server whenever ollamaServer changes.
    • That means that if the server went offline after starting a new session the status would still appear as online.
    • This is not ideal because submitting the form to an offline server would cause an error but we should handle that behavior in #49
  • Should add a new test for this behavior in sessions.test.ts

Add support for all Ollama /api/generate parameters

Extended Parameter Support for Ollama API in Hollama Interface

The Hollama interface currently supports a limited set of parameters when making requests to the Ollama generate API. The current completion request payload looks like this:

let payload: OllamaCompletionRequest = {
    model: session.model,
    context: session.context,
    prompt: session.messages[session.messages.length - 1].content
};

Request

We would like to extend the Hollama interface to support more of the parameters available in the Ollama generate API. This would provide users with greater control over their interactions with the models.

Proposed Parameters to Add

Based on the Ollama API documentation, I suggest adding support for the following parameters:

  1. images: For multimodal models
  2. format: To specify the response format (e.g., JSON)
  3. options: For additional model parameters (e.g., temperature)
  4. system: To override the system message defined in the Modelfile
  5. template: To override the prompt template defined in the Modelfile
  6. stream: To control whether the response is streamed or returned as a single object
  7. raw: To allow specifying a full templated prompt without formatting
  8. keep_alive: To control how long the model stays loaded into memory

Implementation Considerations

  • The interface would need to be updated to include input fields/controls for these new parameters (some of these could go in the settings page, but we may want to consider including others in the session page so that the params can be modified on a per session basis)
  • Default values should be considered for optional parameters

Questions

  • Are there any specific parameters that should be prioritized?
  • Are there any concerns about exposing these parameters to users through the Hollama interface?

Ollama Params

Add markdown syntax highlighting to `TextFieldEditor`

References:

Example (source):

import {basicSetup, EditorView} from "codemirror"
import {markdown} from "@codemirror/lang-markdown"
import {languages} from "@codemirror/language-data"

// The Markdown parser will dynamically load parsers
// for code blocks, using @codemirror/language-data to
// look up the appropriate dynamic import.
let view = new EditorView({
  doc: "Hello\n\n```javascript\nlet x = 'y'\n```",
  extensions: [
    basicSetup,
    markdown({codeLanguages: languages})
  ],
  parent: document.body
})

Consider moving redirect logic in `/` to `hooks.client.ts`

REF #70

// FIXME: This behavior may belong in hooks.client.ts
	beforeUpdate(() => {
		if (!$settingsStore?.ollamaServer) {
			// FIXME:
			// This should only rediect to /settings if the server is not connected
			goto('/settings');
		} else {
			goto('/sessions');

Add timestamps to sessions and sort the history by last updated

  • Should add an updatedAt field to Sessions
  • Once Sessions have dates we should sort them in descending order, where the most recent ones are at the top.
  • The current implementation already does apply sorting but not based on the date.
  • A similar implementation was done for Knowledge
  • In the Knowledge section we should sort the list by updatedAt as well and also display it on the UI formatted with date-fns using the formatDistance helper.
  • The current Knowledge timestamp is rendered to the UI in src/routes/knowledge/+layout.svelte

Improve markdown formatting

image

  • <pre> after a <p> has no spacing
  • <code> inside <p> is styled but not inside <li>'s
  • Content inside <ul>'s should be indented to the right of the bullet point Fixed by #27

Support for multiple knowledges per session

Support for Multiple Knowledge Bases per Session

Current Situation

Currently, Hollama allows users to select a single knowledge entry per session. This limits the flexibility and depth of information that can be incorporated into a single conversation.

Feature Request

We propose adding support for selecting and using multiple knowledges within a single session. This would allow users to combine different sources of information, creating more comprehensive and versatile conversational contexts.

Proposed Functionality

  1. User Interface Updates:

    • Modify the knowledge selection dropdown to allow multiple selections.
  2. Logic Changes:

    • Modify the request payload creation to incorporate information from all selected knowledges.

Benefits

  1. More comprehensive responses by combining multiple sources of information.
  2. Greater flexibility in tailoring sessions to specific needs.
  3. Improved ability to handle complex, multi-domain queries.

Implementation Considerations

  • Should there be a limit on the number of knowledge bases that can be selected? I don't think there should be.
  • How might this affect the model's context window and response generation time? This is where allowing the user to edit the Ollama num_ctx param would come in handy. See Ollama docs.
  • Does Ollama support multiple CONTEXT tags? Here's a relevant snippet from ollama.ts.
	const firstMessage = session.messages[0]
	if (firstMessage.knowledge) {
		payload.prompt = `
			<CONTEXT
				name="${firstMessage.knowledge.name}"
				id="${firstMessage.knowledge.id}"
				updatedAt="${firstMessage.knowledge.updatedAt}"
			>
				${firstMessage.knowledge.content}
			</CONTEXT>

			${payload.prompt}
		`;
	}
  • The Message interface would need to be updated to support a list of Knowledges. Maybe these two should be decoupled? Or better yet, maybe only the Session interface should contain the list of Knowledge's. Here's the relevant snippet from sessions.ts:
export interface Message {
	role: 'user' | 'ai' | 'system';
	content: string;
	knowledge?: Knowledge;  // Remove this one?
}

export interface Session {
	id: string;
	model: string;
	messages: Message[];
	context: number[];
	knowledge?: Knowledge;  // Make this an array of Knowledges?
}

Questions for Discussion

  1. Are there any concerns about the complexity this might add for new users?
  2. Should this be an "advanced" feature, or available to all users by default?

Thanks for your consideration @fmaclen! I might have time to take this one on soon if you'd like, but I know you're working on a major UI overhaul, so maybe I'll wait until that one is merged in.

Add relevant `<title>` tags

  • Here's an example of a similar implementation I've done in another Svelte project.
  • The format of the titles should be:
    • ["Title of the session", "Sessions", "Hollama"]
    • ["Name of the knowledge", "Knowledge", "Hollama"]
    • ["Settings", "Hollama"]

Summarize current session

This would helpful as a form of token-count compression.
Every 5-10 messages you could summarize and start over at a much lower token count but, hopefully, much more relevant.

  • When a session has 2 or more messages in the history a button appears with the label "Summarize"
  • Once clicked it changes the view to a full-screen form with these fields:
    • Choose Model select
    • Choose Knowledge select
    • A disabled "Prompt" texarea
    • A "Summarize" button to submit the form
  • After summarization the "Prompt" field becomes editable
  • The "Summarize" button is replaced with one that reads "New session"
  • Clicking "New Session" starts a new session with the summarized session as the new prompt.

Vite/Rollup: Large chunks warning

I'm not that familiar with the Vite build process to figure out where exactly this issue is.

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

Not 100% sure, but I think this is a casualty of having started the project with shadcn-svelte which added a lot of code.

For reference, here is where it was introduced:
#11

And where was removed:
#33

I kept the Tailwind setup and the Lucide icon library so it's possible one of those might be causing the warning.

Sessions: remove draggable panel resizer and add a button to toggle a "fullscreen mode"

REF #70

The draggable behavior to resize the height of the text-editor has some limitations that cause the Prompt field to sometimes be too short with vertical scrollbars, among other quirks.

The ability to increase the size of the Prompt field is really useful but we don't necessarily need to allow the field to be resizable with that precision.

Instead let's add a "toggle button" that can switch the height of the prompt area from "5 lines" to "fullscreen".

  • Remove PaneGroup, Pane, PaneResizer and the entire paneforge library
  • In non-fullscreen mode the input is a regular <textarea /> and in "fullscreen mode" we switch to the <FieldTextEditor />
  • When it's a textarea we submit the form by pressing Enter (the way it used to be before this PR), when we switch full screen we keep the same keyboard shortcut: Meta + Enter
  • The full screen text editor shouldn't occupy more than 66% of the viewport so the chat history could be referenced while typing on the larger text input.
  • Clicking on the fullscreen button again should "shrink" the height of the text box back to the original height.
  • The size of the text input should "shrink" back to the original height after submitting a prompt.

Here's a rough mockup:

image

Convert to static site

  • Save session/contex on browser's localStorage
  • Add ability to set the Ollama server and model in the UI
  • Update config to deploy to Cloudflare Pages

Reset session when an error occurs

  • Should probably need a dedicated UI component for handling error messages, such as a flash alert/toast
  • When the prompt fails undo the last prompt into prompt field
  • Should implement these tests.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.