Giter Club home page Giter Club logo

admin-vue's Introduction

Discord Server GitHub Stars GitHub Forks GitHub License GitHub Issues GitHub Pull Requests

Cheshire Cat Admin UI 🐱

This is the source code to build the admin client for the Cheshire Cat AI.

About the project

The Cheshire Cat is a framework to build long-tail AIs:

  • Language model agnostic, allows compatibility with OpenAI, Cohere, HuggingFace, and custom models
  • Long-term memory storage capabilities
  • Seamless integration with external tools, such as APIs and other models
  • Ability to ingest various document formats, including PDFs and text files
  • 100% dockerized for simple and efficient deployment
  • Extensibility via plugins, offering unparalleled flexibility to users.

Pre-requisites

Make sure you have the following installed on your machine:

  node v18.15+

Installation

This project uses pnpm as the package manager. You can install it by running:

  npm install -g pnpm

Then, install the dependencies:

  pnpm install

Scripts

Here's a list of scripts that you can run to get the app up and running

Dev mode

Run the app in dev mode with hot-reloading enabled and the browser automatically opening on port 3000 (default)

  pnpm run dev

Build

Build the app for production

  pnpm run build

Start the app

Runs the build and serves the built app on port 3000 (default)

  pnpm run preview

admin-vue's People

Contributors

angydev avatar antonioru avatar calebgcc avatar clarequrv avatar dshkmg avatar elio1fiore avatar eugeniopetulla avatar fedestyla avatar github-actions[bot] avatar jhonnyr97 avatar joke2k avatar kodaline avatar lorenzopalloni avatar paperbackpear3 avatar pieroit avatar salvog7 avatar steve707-ae avatar tochka21u avatar zalweny26 avatar zap123 avatar zioproto 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

admin-vue's Issues

[Feature] Add a "hide" button in chat

Describe the solution you'd like
The chat bubble, in combination with the new "Read more..." button, should have a "Hide" or "Hide content..." button to collapse the text after it was expanded by the "Read more...".

First API call from admin to core should say if there is a connection problem

At the moment when the admin connects to core, it shows the API_KEY modal both if an API_KEY is requested to access the endpoints, but also when there are connection issues (most of the time noobs that misconfigured or not configured at all CORE_HOST in .env file).
Can we give out a proper error message for wrong address?

Another option is to follow @sambarza's suggestion and instead of injecting CORE_HOST to the admin, just make it connect to the same address it has been served (window.location.something...)

[Bug] Microphone recording doesn't work in every browser

Describe the bug
The microphone button doesn't appear in some browsers (like Firefox) and in others does but without working. Actually, I tested it only on Edge.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Home' page
  2. Click on the microphone button (if you see it)
  3. Nothing happens when talking

Expected behavior
I expect the microphone to work on every browser.

Admin release used in latest docker builds (1.4.5 and 1.4.6) has issues

  • Admin detail color is purple
  • dark mode does not work (remains light, cat logo goes away, why button is a black circle)

Screenshot from 2024-01-17 23-28-34

cat.js complains in home page about a missing path attribute

Screenshot from 2024-01-17 23-30-25

LLM and embedder settings:

  • LLM starts on chatGPT instead of DefaultLLM
  • There is an error from cat.js about a label field

Screenshot from 2024-01-18 00-19-54

[Bug] Ollama responses are not well formatted

Describe the bug
The full response output looks a bit like a big blob, and harder to digest. See the screenshot for the current output.

To Reproduce
Enable Ollama and LLama2 as the LLM provider

Expected behavior
The output should be well formatted with distinct paragraphs.

Screenshots

image

Improve form to allow any type used in JSON Schema

Describe the reason of this issue
Can also totally replace the current library used for dynamic form

The issue is present here:

import { merge } from "lodash"
import { Form, Field } from "vee-validate"

// FEATURE: Improve form to allow any type of input based on json schema
// Can also totally replace the current library used for dynamic form

const props = withDefaults(
	defineProps<{
		fields: SchemaField[]

[https only] LLM settings (PUT) fails in the admin

How to replicate

Under https all endpoints work fine in the admin, with the exception of the endpoint to PUT the LLM configuration. When hitting "Save" on the config:

  • browser complains Mixed Content: The page at 'https://DOMAIN/admin/settings' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://DOMAIN/llm/settings/LLMOpenAIChatConfig'. This request has been blocked; the content must be served over HTTPS., By checkin the browser network console, looks like not the request header, but the response header misses https.
  • Also a strange redirect happens in the logs serverside
    Screenshot from 2024-01-11 16-02-08

Observations:

  • no problems with all the other https and wss endpoints
  • using the same endpoint from the swagger /docs, gives no problem and the config is correctly saved; also no redirect server side.
  • maybe the server side redirect is simply due to the / at the end of the endpoint call

[Feature] Add `Import Memories` button in the "Memory" page

It would be nice to have another Import Memories button close to the Export Memories one, in the "Memory" page.

Here is an example proposal (the button color is random):
Frame 1

P.S.: an issue like this, with a wireframe like this può accompagnare solo

Shorten long messages in chat

Is your feature request related to a problem? Please describe.
When an user copy/pasters a long text in the chat, the backend gives an error (will be fixed) and in any case the message bubble would become huge.

Describe the solution you'd like
Backend should be able to deal with long texts, and the admin just make the message box small so it does not occupy visual space

Hide plugin activation switch

People is lamenting that the plugin on/off switch "does not work"

Of course we know it is just deactivated, but since it creates confusion let's hyde it until the backend supports activating/deactivating plugins

Fix css styling for code snippets in markdown

Describe the reason of this issue
The current code doesn't work, it just imports them and use the latest imported

The issue is present here:

const { isDark } = storeToRefs(store)

watchEffect(() => {
	// BUG: Fix css styling for code snippets in markdown
	// The current code doesn't work, it just imports them and use the latest imported
	if (isDark.value) import("highlight.js/styles/github-dark.css")
	else import("highlight.js/styles/github.css")
})

[Bug] plugins page scrolls to the bottom repeatedly if the cat is talking.

Describe the bug
plugins page scrolls to the bottom repeatedly if the cat is talking.

To Reproduce
1.) talk to the cat
2.) while the cat is thinking get bored and click on plugins.
3.) after the cat is done thinking he'll start talking and the plugins page will repeatedly scroll to the bottom until the cat is finished.

Expected behavior
I'm not sure I guess... a normally functioning plugins page since the message window isn't visible.

Screenshots
Here's a video instead.
https://drive.google.com/file/d/1CyHpf6qOMuRuinrCoBqkjG0RSHyOkqUW/view?usp=drive_link

Additional context
Add any other context about the problem here.

Websocket messages containing just a number are not shown in the chat

Note
I was sure this was a backend issue about tools, but I just verified that the websocket message in fact arrives to the admin. Maybe there is some check about content being a string

Screenshot from 2024-01-13 01-13-03

To Reproduce

  1. create a tool with @tool(return_direct=True)
  2. tool returns a number return 2
  3. message does not end up in the chat

If you return "2", the message is correctly picked

[Bug] Activation toggle should not be set activate if plugin activation fails

Describe the bug
If a plugin fails to activate due to an error, the admin correctly shows an error notification, but the toggle is set to on anyway.

To Reproduce
Steps to reproduce the behavior:

  1. Develop a plugin with a bug
  2. Activate the plugin from the admin
  3. See the toggle activating but the notification and the terminal raising an error

Expected behavior
The toggle should stay on deactivated

Screenshots
immagine

[Feature] App version reference on UI

I think should be useful to have the app version info directly on the UI (at least in the admin panel).
The app version could be useful to check if there are updated releases.

[SOLVED] Impossible to use the admin chat after document summarization

EDIT: Solved

Fix: close your fucking tabs!


Describe the bug
Having plugins such the summarization, I see that the GUI freeze whenever an alert arrives, so is basically impossible do chat during the ingestion. I'm using the latest debug branch!

To Reproduce
1 - Install Summarization plugin
2 - Ingest a PDF
3 - Try to chat

Expected behavior
Maybe you should be able to chat during ingestion.

Screenshots
I see a loop of the following screenshots
bug 1
bug

[BAD BUG] Cached LLM/Embedder settings overwrite actual settings and mess up updates

Admin keeps a cached version of LLM/embedder settings that has side effects on other settings visualization and save/load.

image

In this case model is not visible while having a clear default in factory.
IF any setting is saved, old config and new one gets mixed (breaking installation)

IMPORTANT: Do not cache settings, as it happens in plugins, make a request every time the panel opens up

Filters for recalled memories

Is your feature request related to a problem? Please describe.
Since we have timestamps for memories, it would be nice to have a couple of time filters in the memory page (from / to).

Steps:

  1. recall endpoint ignores time filters and the time filtering is done in the admin
  2. recall endpoint is able to filter by time interval directly in the backend

Filters (from/to) could be shown as dd/mm/yyyy and handled internally as unix timestamps (which is waaay better)

[Bug] apiClient still uses http even if the window.location.protocol is "https"

I suspect this is due to window.location.port is empty if window.location.protocol == 443

See file: https://github.com/cheshire-cat-ai/admin-vue/blob/main/src/api.ts#L12

export const apiClient = new CatClient({
	baseUrl: window.location.hostname,
	port: parseInt((DEV ? '1865' : window.location.port) ?? '80'),
	secure: window.location.protocol === 'https:',
	timeout: 15000,
	ws: {

This is in fact a misuse of window.location.port, see the example below to understand:

image

Embedder config panel only shows the selected embedder the second time

Core now gives what is the selected embedder, even if it was automatically selected
In this case:

"selected_configuration": "EmbedderOpenAIConfig"

The chosen Embedder is chosen rightfully, but only on second open

screencast-bpconcjcammlapcogcnnelfmaeghhagj-2023.08.28-19_22_27.webm

Admin auth with JWT

Admin is served from core only to authenticated users.
When the admin loads up, there is a Cookie header with ccat_user_token=xxx

Flow:

  • at startup, get the cookie value. If there is no cookie, do everything as usual.
  • for http requests, use the header:
    • Authorization: Bearer xxx
  • for ws connection, use the url query param:
    • ws://<cat-url-and-port>/ws/?token=xxx

User info:

  • user info can be obtained by decoding the JWT
  • (show username)

Notes:

  • it may be hard to pass the JWT to the admin in dev version

Later issues:

  • hide selectively pages according to permissions
  • for another issue, when core supports refresh token, refresh it

The settings should use a JSON Schema form generator

Is your feature request related to a problem? Please describe.
It is better if the settings use a JSON Schema form generator for better validation and readability.
This can also easily fix #27 .

Describe the solution you'd like
I found this one which seems to be good also for customization (like custom styling).

UPDATE
I tried the library but it doesn't seem to work properly:
image

Drag & drop for both documents and URLs

Is your feature request related to a problem? Please describe.

As a plus, would be nice to have drag and drop into the chat to ingest documents and URLs instead of buttons only.

SECURITY: admin container should connect to the core API using an API_KEY

The core container implements API_KEY to protect from unauthorized requests.
https://github.com/pieroit/cheshire-cat/blob/5795d6bb888d8ed8edc092f87e22ed5336543f61/core/cat/routes/openapi.py#L6

Running the core container without API_KEY is a huge risk because it can leak the OpenAI keys stored in the configuration.

The admin container does not support connecting to the core container specifying the API_KEY. This should be implemented as soon as possible to make the usage of API_KEY mandatory by default.

[Feature] Mathematical Formulae should be correctly displayed

I think it would be really convenient if the Mathematical Formulas were rendered and displayed correctly, as is the case with ChatGPT. In my case I tested Markdown, KaTeX and LaTeX, and none of the three are displayed correctly.

Additional context
image
image

[Feature] Support lists in plugin settings

Is your feature request related to a problem? Please describe.
At the moment the lists are not supported in plugin settings, making it impossible to ask for an array of strings (for example).

Describe the solution you'd like
Support the lists json schema so that it can be used in plugin settings.

[Bug] Numbered lists in the chat are not rendered correctly

Describe the bug
The LLM is returning a numbered list but it is not rendered correctly in the chat window.

To Reproduce

This is the text returned by the LLM:

"\nSure! Here are the steps to prepare Tiramisu:\n\n1. Brew espresso and let it cool.\n2. Beat egg yolks with sugar until pale and creamy.\n3. Add mascarpone cheese and beat until smooth.\n4. In a separate bowl, beat egg whites until stiff peaks form.\n5. Fold egg whites into the mascarpone mixture.\n6. Dip ladyfingers in espresso and arrange them in a dish.\n7. Pour half of the mascarpone mixture over the ladyfingers.\n8. Repeat steps 6 and 7.\n9. Dust with cocoa powder and refrigerate for at least 4 hours.\n10. Enjoy!"

Expected behavior
I expect the text to be rendered as a numbered list.

Screenshots

This is the returned text from the browser developer tools:
Screenshot 2023-06-23 at 16 59 04

This is the screenshot of how it appears, the numbers are missing:

Screenshot 2023-06-23 at 16 58 32

[Bug] The cat shakes when writing in markdown

Describe the bug
When trying to get something written in markdown, the ui starts vibrating and shaking in a strange way.

Screenshots

vibrate.mp4

Additional context
In the "Prompt prefix" of the "C.A.T. - Cat Advanced Tools" Plugin I wrote "Always write math formulas in markdown language."

Heavy duty endpoints

There are endpoints doing possibly long and delicate jobs, for example:

  • change of llm
  • change of embedder
  • plugin install/uninstall
  • plugin toggle

Admin should:

  • trigger the endpoint
  • endpoint will respond immediately with status code 200 (job started)
  • admin will poll endpoint with setInterval to check for data change (i.e. plugin is active/inactive or installed/uninstalled)
  • admin refreshes accordingly

Summoning @zAlweNy26 & @kodaline with moral support by @pieroit

Auto refresh admin stores after core finishes long tasks

There are core endpoints doing possibly long jobs, for example:

  • change of llm
  • change of embedder
  • plugin install/uninstall
  • plugin toggle
  • rabbithole file/url/memories

At the moment their behaviour is inconsistent, as some of them are sync (client gets response when job is finished) and some are async (client gets response immediately and gets a websocket notification when job is finished).

We should devise a common behaviour so clients (and first of all the admin) are offered a consistent interface.
After that we can align the admin so it auto refreshes its stores when such endpoints are finished with their job (e.g. no need to manually refresh after uploading a plugin or a memory)

This issue should be tackled after those endpoints are aligned in core, see here

Switch episodic/declarative collections on/off

Is your feature request related to a problem? Please describe.
Users may be interested in activating or deactivating one or both memories.

Describe the solution you'd like
Send via websocket a json containing not only the text but also prompt settings

{
    "text": "....",
    "prompt_settings": {
        "use_declatarive_memory": false,
        "use_episodic_memory": true,
    }
}

Describe alternatives you've considered
After a conversation in the Discord we reached agreement on these as the most useful options at the moment.

@zAlweNy26 @cristianorevil feel free to redesign wireframe and datastructure as you see fit or involve the community in case you want support

Add more E2E and Unit tests

At the moment, the project doesn't have enough E2E and Unit tests to ensure that everything works fine.

Describe the solution you'd like
There should be unit tests for each component and store present.
Also, there should be other e2e tests, that work fine even if the core is needed.

[Bug] Upload File does not work in Safari

Describe the bug
On Safari in MacOS Sonoma, the "Upload File" button is unresponsive and does not bring up the expected dialog. This is in contrast to the "Upload Memories" document, which appears to function correctly.

To Reproduce
Steps to reproduce the behavior:

On MacOS, using the latest version of Safari:

  1. Open the Admin UI.
  2. Click the "Lightning Menu"
  3. Click "Upload File"
  4. Observe nothing occurs.
  5. Click "Upload memories"
  6. Observe the safari file upload dialog is displayed.

Expected behavior
I'd expect a similar file upload dialog to be displayed for "Upload File", but with a different file filter applied..

Screenshots
image
Nothing happens
image
"Upload memories" brings up the expected dialog.

Additional context
The functionality does appear to work on MSEdge on MacOS Sonoma, just not Safari.

[Feature] Fix TODOs present in the code

Is your feature request related to a problem? Please describe.
There are some TODOs present in the code that should be fixed.

Describe the solution you'd like
There should be a fix for each TODO, also replacing the current workaround code if needed.

Show upgrade button for plugins

core has been updated to show whether a plugin has a new version from registry

  • info is shown for the GET /plugins/ endpoint
  • inside an installed plugin data, there is a key upgrade:
    • null if there are no new versions
    • string (e.g. "1.3.0") if there is a new version

Example of not upgradable plugin:

{
      "id": "purrcast_podcast_finder",
      "name": "PurrCast - Podcast Finder",
      "description": "Search for public podcast shows and episodes on Spreaker.",
      "author_name": "Eugenio Petullà",
      "author_url": "https://github.com/EugenioPetulla",
      "plugin_url": "https://github.com/EugenioPetulla/PurrCast_Podcast_Finder",
      "tags": "podcast, multimedia, entertainment",
      "thumb": "https://raw.githubusercontent.com/EugenioPetulla/PurrCast_Podcast_Finder/main/logo.png",
      "version": "1.1.0",
      "active": true,
      "upgrade": null,
      "hooks": [],
      "tools": []
},

Example of upgradable plugin:

{
      "id": "purrcast_podcast_finder",
      "name": "PurrCast - Podcast Finder",
      "description": "Search for public podcast shows and episodes on Spreaker.",
      "author_name": "Eugenio Petullà",
      "author_url": "https://github.com/EugenioPetulla",
      "plugin_url": "https://github.com/EugenioPetulla/PurrCast_Podcast_Finder",
      "tags": "podcast, multimedia, entertainment",
      "thumb": "https://raw.githubusercontent.com/EugenioPetulla/PurrCast_Podcast_Finder/main/logo.png",
      "version": "1.1.0",
      "active": true,
      "upgrade": "1.2.0",
      "hooks": [],
      "tools": []
},

Endpoint to update and checks to delete the older version and upload the new are not yet there.
We can just use the already present endpoint to install plugins from registry and core can do the checks, so admin side you can just get the plugin URL and use the endpoint POST /plugins/upload/registry

Fix `resetAllStores` and remove the workaround

Describe the reason of this issue

The issue is present here:

// BUG: Fix `resetAllStores` and remove the workaround
router.beforeEach(async to => {
	if (!isReadyAndAuth.value && to.name !== 'settings') {
		return { name: 'settings' }
	}
})

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.