lmg-anon / mikupad

LLM Frontend in a single html file
https://lmg-anon.github.io/mikupad/mikupad.html
Creative Commons Zero v1.0 Universal
233 stars 26 forks source link

added breakdown bar for context #76

Open neCo2 opened 4 months ago

neCo2 commented 4 months ago

Added bars that show the composition of your current context in the sidebar and in the context modal. Per default, it isn't visible in the sidebar and has to be turned on in the editor settings modal.

firefox_2024-06-04_21-16-24 firefox_2024-06-04_21-16-38

We should probably talk about the colors, because it's pretty ugly right now.

lmg-anon commented 3 months ago

I think this is an interesting feature, especially if we could show how much of the context is left. But as it stands, this does look ugly and out of place. Honestly, I'm not very good with colors (or any kind of design), so I'm not sure about what to suggest in this case. Maybe for the color it would be necessary to add a palette to all themes, instead of just one color?

neCo2 commented 3 months ago

Added a "Free Context" part to the bar. I can't test it as I don't have llamacpp set up right now, but it should work. I'll try to get it up and running again soonish and check.

As for the different colours for different themes, I frankly cannot be arsed to come up with even more colours, but I have added classes to all the bars the component generates, so it is now possible to do that.

lmg-anon commented 3 months ago

As for the different colours for different themes, I frankly cannot be arsed to come up with even more colours, but I have added classes to all the bars the component generates, so it is now possible to do that.

Yeah, the easiest way would be to use some algorithm to derive the colors from --color-base, but I don't know if this is even possible in a satisfactory way or if it would be possible to make it look good.
But anyway, I think it doesn't look as bad if the height is reduced (0.5em): image

Also, strangely enough, the bar disappears when the sidebar scrollbar appears: image image

neCo2 commented 3 months ago

Keep in mind that the free context part is not accurate since we just guesstimate prompt size, so it's not all that useful.

I don't know if this is even possible in a satisfactory way

Maybe I'll wrestle with that sometime when I have absolutely nothing else going on.

Also, strangely enough, the bar disappears when the sidebar scrollbar appears

Oh that's weird, never noticed that.

lmg-anon commented 3 months ago

Keep in mind that the free context part is not accurate since we just guesstimate prompt size, so it's not all that useful.

Hm, that's true, and this "guesstimation" must be quite off for models like LLaMA 3, which tokenize much more effectively than other models. But I guess that's not the breakdown bar's fault at least.