Skip to content

Commit

Permalink
Add buttons marking the quality of a chat message
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhellsten committed Jan 20, 2024
1 parent afb5688 commit 592c2df
Show file tree
Hide file tree
Showing 19 changed files with 584 additions and 78 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
tmp

.envrc

# Logs
logs
*.log
Expand Down
26 changes: 24 additions & 2 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
:80

root * dist/
# Enable the static file server
file_server
try_files {path} /index.html

# Add compression
encode zstd gzip

# Reverse proxy configuration for the API
reverse_proxy /api/* {
to http://localhost:11434

# basicauth /* {
# apitoken $2a$14$sI1j0RbhzKHMZ4cHU8otHOkB3Dgl9egF2D.CXB6C0/Qk5dtaMHS/u
# }
# Remove Origin
# header_up -Origin
# Add a new Origin header
# header_up Origin http://127.0.0.1
}

root * dist/

log {
output stdout
format json
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ $ parcel build index.html
<details>
<summary>Tasks</summary>

- [ ] Personas / Characters / Custom GPTs
- [ ] Ollama authentication
- [ ] Edit message / response
- [ ] Clear chat
Expand Down
4 changes: 4 additions & 0 deletions css/ChatList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
transparent
); // Fade out title instead of ellipsis
}

.button {
padding: 0.25rem 0.75rem;
}
}

.list-item.selected {
Expand Down
6 changes: 6 additions & 0 deletions css/DropDownMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
position: absolute;
top: 100%; /* Position below the button */
display: none; /* Hide initially */
font-size: 0.75rem;
white-space: nowrap;

i[class^='icon-']::before {
padding-right: 0.5rem;
}

@extend %box-shadow;

Expand Down
10 changes: 6 additions & 4 deletions css/button.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
button {
background-color: var(--button-secondary-bgcolor);
z-index: 1;
padding: 0.75rem 1rem;
border: none;
cursor: pointer;
}

.button {
padding: 0.75rem 1rem;

i {
width: 1rem; // Center the icon
display: inline-block;
}
}

button:hover,
button.selected {
.button:hover,
.button.selected {
@extend %box-shadow-hover;
}

Expand Down
19 changes: 18 additions & 1 deletion css/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ svg {
vertical-align: middle;
}

.icon-flag::before {
content: "\1F6A9"; /* Triangular Flag on Post */
content: "\26A0";
}

.icon-good::before {
content: "\1F44E"; /* Thumbs Down */
}

.icon-bad::before {
content: "\1F44D"; /* Thumbs Up */
}

.icon-close::before {
content: '\00D7';
}
Expand Down Expand Up @@ -60,10 +73,14 @@ svg {
content: '\1F4E9';
}

.icon-delete::before {
.icon-delete-alt::before {
content: '\274C';
}

.icon-delete::before {
content: '\2716';
}

.icon-abort::before {
content: '\00D7';
color: var(--red);
Expand Down
3 changes: 2 additions & 1 deletion css/modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
border-bottom: 1px solid var(--border-color);

.button {
background-color: var(--light-text-color);
color: var(--text-color);
background-color: var(--bg-color);
padding: 0.35rem;
line-height: 0.5rem;
border-radius: 0.1rem;
Expand Down
2 changes: 1 addition & 1 deletion css/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,5 @@ html * {
}

html {
font-size: 16px; /* Standard font size for body, use rem to modify font-size */
font-size: 14px; /* Standard font size for body, use rem to modify font-size */
}
60 changes: 33 additions & 27 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<body>
<div id="chat-app">
<header id="chat-header" class="row">
<button id="hamburger-menu" class="hamburger-menu button" title="Hide sidebar">
<button id="hamburger-menu" class="hamburger-menu button" title="Collapse or expand the sidebar">
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<rect x="4" y="6" width="16" height="2" fill="black"></rect>
<rect x="4" y="11" width="16" height="2" fill="black"></rect>
Expand All @@ -40,19 +40,19 @@
<button id="new-chat-button" class="button" title="New chat">
<i class="icon-new"></i>
</button>
<div id="chats-menu" class="drop-down-menu col">
<div id="chats-menu" class="drop-down-menu drop-down-menu-right col">
<button id="chats-menu-button" class="button" title="Chats menu">
<i class="icon-menu"></i>
</button>
<div class="drop-down-menu-items hidden">
<button id="search-button" class="button" title="Search chats">
<i class="icon-search"></i>
<button id="search-button" class="button row" title="Search chats">
<i class="icon-search">Search chats</i>
</button>
<button id="export-button" class="button" title="Export all data">
<i class="icon-download"></i>
<button id="export-button" class="button row" title="Export all data">
<i class="icon-download">Download chats</i>
</button>
<button id="clear-button" class="button" title="Delete all chats">
<i class="icon-clear"></i>
<button id="clear-button" class="button row" title="Delete all chats">
<i class="icon-clear">Delete chats</i>
</button>
</div>
</div>
Expand All @@ -73,26 +73,26 @@
</button>
<div class="drop-down-menu-items hidden">
<button id="edit-chat-button" class="button row" title="Edit chat title">
<i class="icon-edit"></i>
<i class="icon-edit">Edit title</i>
</button>
<button class="button copy-button row" title="Copy chat to clipboard" data-target="chat-history">
<i class="icon-copy"></i>
<i class="icon-copy">Copy chat</i>
</button>
<button id="delete-chat-button" class="button row" title="Delete chat">
<i class="icon-delete"></i>
<i class="icon-delete">Delete chat</i>
</button>
<button data-target="chat-history" class="button download-button row" title="Download chat">
<i class="icon-download"></i>
<i class="icon-download">Download chat</i>
</button>
<button id="chat-settings-button" class="button" title="Chat settings">
<i class="icon-settings"></i>
<i class="icon-settings">Chat settings</i>
</button>
</div>
</div>
<button id="scroll-to-top-button" class="row">
<button id="scroll-to-top-button" class="row button">
<i class="icon-scroll-to-top"></i>
</button>
<button id="scroll-to-end-button" class="row">
<button id="scroll-to-end-button" class="row button">
<i class="icon-scroll-to-end"></i>
</button>
</aside>
Expand Down Expand Up @@ -169,25 +169,31 @@ <h2 class="col grw chat-title">Chat settings</h2>
<template id="chat-message-template">
<div class="chat-message">
<span class="chat-message-text"></span>
<div id="chat-message-menu" class="drop-down-menu col hoverable">
<button id="chats-menu-button" class="button" title="Chats menu">
<i class="icon-menu"></i>
</button>
<div class="drop-down-menu-items hidden">
<button class="delete-chat-message-button button" title="Delete chat message">
<div id="chat-message-menu" class="col hoverable">
<button class="delete-chat-message-button" title="Delete chat message">
<i class="icon-delete"></i>
</button>
</div>
</div>
</button>
<button class="copy-chat-message-button" title="Copy chat message to clipboard">
<i class="icon-copy copy-button"></i>
</button>
<button class="good-chat-message-button copy-button" title="Good chat message">
<i class="icon-bad"></i>
</button>
<button class="bad-chat-message-button" title="Bad chat message">
<i class="icon-good"></i>
</button>
<button class="flag-chat-message-button" title="Flag chat message">
<i class="icon-flag"></i>
</button>
</div>
</template>
</div></template>
<!-- Chat list item template -->
<template id="chat-list-item-template">
<li class="chat-list-item list-item row">
<span class="chat-title col grw"></span>
<!--<button class="list-item-edit" title="Edit chat">...</button>-->
<button class="list-item-delete" title="Delete chat">
<i class="icon-close"></i>
<button class="list-item-delete button" title="Delete chat">
<i class="icon-delete"></i>
</button>
</li>
</template>
Expand Down
30 changes: 28 additions & 2 deletions dist/script.d573be0b.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/script.d573be0b.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 592c2df

Please sign in to comment.