built web

This commit is contained in:
AndzejsP 2023-05-03 18:03:50 +03:00
parent 659e97541f
commit 0d189eec30
11 changed files with 180 additions and 38 deletions

Binary file not shown.

Binary file not shown.

11
web/dist/assets/index-219239d4.js vendored Normal file

File diff suppressed because one or more lines are too long

1
web/dist/assets/index-56a2d3b5.css vendored Normal file

File diff suppressed because one or more lines are too long

66
web/dist/assets/logo-9d653710.svg vendored Normal file
View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="154.55025mm"
height="160.5979mm"
viewBox="0 0 154.55025 160.5979"
version="1.1"
id="svg5"
xml:space="preserve"
inkscape:export-filename=".\bitmap.svg"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.74564394"
inkscape:cx="34.198628"
inkscape:cy="502.92101"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" /><defs
id="defs2" /><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-14.273257,-30.765575)"><g
id="g1477"
clip-path="none"><g
inkscape:label="Clip"
id="g1475"><path
style="fill:#87bcfc;fill-opacity:1;stroke-width:0.671958"
d="m 37.623501,174.81447 c 0.007,-0.32225 0.9351,-1.94664 2.06305,-3.60973 2.92939,-4.31919 6.3891,-11.85421 7.57755,-16.50344 2.42423,-9.48355 2.02669,-14.17374 -2.19558,-25.90381 -1.14539,-3.18206 -2.24968,-7.71777 -2.45398,-10.07937 -0.61281,-7.08403 -0.97277,-8.66153 -1.97638,-8.66153 -0.67782,0 -1.00077,1.08931 -1.14548,3.86375 -0.20152,3.86376 -0.20152,3.86376 -5.28154,4.05771 -4.28191,0.16349 -5.26053,-0.005 -6.2289,-1.07553 -1.49222,-1.64887 -2.13911,-9.75354 -1.48009,-18.543543 0.64593,-8.6156 1.2217,-9.267277 7.94617,-8.99395 4.84284,0.196846 4.84284,0.196846 5.04741,3.76685 0.16812,2.93382 0.40761,3.5311 1.34392,3.35169 0.90629,-0.17365 1.23876,-1.31385 1.62536,-5.57425 1.24545,-13.72509 7.49751,-23.935675 17.85868,-29.165978 7.67738,-3.875526 11.00315,-4.39997 28.02038,-4.418556 12.716999,-0.01389 16.228819,0.193446 19.822759,1.170322 16.87358,4.586448 26.18833,15.973048 28.57473,34.930522 0.57303,4.55212 2.19952,4.33072 2.46819,-0.33598 0.20311,-3.527774 0.20311,-3.527774 4.20685,-3.733474 8.58554,-0.441097 9.28817,0.786184 8.97745,15.680807 -0.26758,12.8269 -0.41714,13.0831 -7.63779,13.0831 -5.48007,0 -5.67938,-0.1788 -5.67938,-5.09464 0,-2.05145 -0.28167,-2.96885 -0.91153,-2.96885 -0.66502,0 -1.03312,1.61078 -1.36117,5.95641 -0.2473,3.27602 -1.07821,8.03852 -1.84646,10.58333 -1.98696,6.58176 -2.1676,9.33137 -0.98406,14.97906 1.33173,6.35492 4.06152,12.17114 7.95714,16.95391 3.07739,3.77821 3.07739,3.77821 -3.15487,1.23266 -19.69789,-8.04552 -35.55024,-11.0994 -48.752359,-9.39192 -15.89274,2.05546 -29.36908,8.40921 -51.13419,24.10845 -0.70296,0.50706 -1.27261,0.65825 -1.26588,0.33598 z m 62.589409,-42.21165 c 5.9799,-1.26742 11.98566,-4.13161 11.98566,-5.71604 0,-1.11368 -0.47322,-1.05196 -5.67146,0.7398 -13.171199,4.53992 -25.095489,3.99787 -38.845739,-1.76584 -0.82894,-0.34747 -1.17592,-0.18264 -1.17592,0.55859 0,1.82186 8.17302,5.69754 14.11111,6.69155 3.96761,0.66417 15.47301,0.36587 19.596349,-0.50806 z M 73.488971,110.38171 c 2.78812,-1.32306 4.43976,-4.1948 4.43976,-7.71954 0,-2.31037 -0.41245,-3.231794 -2.28466,-5.104003 -1.87295,-1.87295 -2.79323,-2.28465 -5.10688,-2.28465 -2.31364,0 -3.23393,0.4117 -5.10688,2.28465 -1.86415,1.864149 -2.28465,2.797883 -2.28465,5.073053 0,3.66807 1.43325,6.29901 4.16485,7.64522 2.76723,1.36377 3.50006,1.37625 6.17846,0.10527 z m 38.709599,-0.90103 c 3.95838,-2.90381 3.91035,-9.13382 -0.0964,-12.505283 -4.8764,-4.10322 -11.98946,-0.26215 -11.99632,6.478043 -0.003,2.6667 2.43096,6.24292 4.98237,7.32146 1.87608,0.79306 5.05342,0.21472 7.11036,-1.29422 z M 50.042481,59.323124 c -2.21746,-0.906755 -4.53378,-2.260293 -5.14739,-3.00786 -0.69217,-0.843283 -1.92333,-1.359213 -3.24349,-1.359213 -3.00243,0 -6.05621,-3.147095 -6.05621,-6.241289 0,-4.458365 3.9273,-7.195145 8.19179,-5.708538 2.75256,0.959548 4.11356,3.947531 3.57655,7.852057 -0.3891,2.829155 -0.24632,3.341284 1.3869,4.974505 1.00136,1.001362 2.83561,2.447931 4.0761,3.214597 2.21006,1.365893 2.75732,1.972171 1.75147,1.940339 -0.27718,-0.0088 -2.31826,-0.757841 -4.53572,-1.664598 z"
id="path227"
inkscape:export-filename="path227.svg"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100" /></g></g><use
x="0"
y="0"
xlink:href="#g1475"
id="use1481" /><path
style="fill:#152f5b;fill-opacity:1;fill-rule:evenodd"
d="m 14.273257,111.06452 c 0,-80.298946 0,-80.298946 77.27513,-80.298946 77.275133,0 77.275133,0 77.275133,80.298946 0,80.29894 0,80.29894 -77.275133,80.29894 -77.27513,0 -77.27513,0 -77.27513,-80.29894 z m 35.379964,56.20584 c 15.342626,-10.36485 26.737224,-15.11376 40.550854,-16.90033 13.202125,-1.70748 29.054465,1.3464 48.752365,9.39193 6.23225,2.54554 6.23225,2.54554 3.15486,-1.23267 -3.89562,-4.78276 -6.6254,-10.59899 -7.95714,-16.9539 -1.18353,-5.64769 -1.0029,-8.3973 0.98406,-14.97906 0.76825,-2.54481 1.59916,-7.30731 1.84647,-10.58333 0.32804,-4.34563 0.69614,-5.95642 1.36117,-5.95642 0.62985,0 0.91152,0.91741 0.91152,2.96885 0,4.91585 0.19932,5.09464 5.67939,5.09464 7.22064,0 7.3702,-0.25619 7.63778,-13.08309 0.31072,-14.894621 -0.39191,-16.121904 -8.97745,-15.680807 -4.00374,0.2057 -4.00374,0.2057 -4.20685,3.733478 -0.26867,4.666692 -1.89516,4.888095 -2.46818,0.335978 -2.38641,-18.957476 -11.70116,-30.344076 -28.57474,-34.930524 -6.40613,-1.741265 -33.307084,-1.70484 -39.591771,0.05361 -15.774724,4.413749 -24.562386,15.305116 -26.110047,32.360608 -0.3866,4.260399 -0.719062,5.400597 -1.625358,5.574251 -0.93631,0.179405 -1.1758,-0.417877 -1.343915,-3.351696 -0.20457,-3.570003 -0.20457,-3.570003 -5.047407,-3.766849 -6.724479,-0.273327 -7.300242,0.378355 -7.946179,8.993948 -0.659013,8.789993 -0.01212,16.894663 1.48009,18.543543 0.968373,1.07004 1.946997,1.23902 6.2289,1.07553 5.080026,-0.19395 5.080026,-0.19395 5.281549,-4.05771 0.144707,-2.77445 0.467651,-3.86376 1.145477,-3.86376 1.003609,0 1.363564,1.57751 1.976382,8.66154 0.204295,2.36159 1.308583,6.89731 2.453973,10.07936 4.222278,11.73008 4.619815,16.42027 2.195588,25.90382 -1.188457,4.64923 -4.648163,12.18425 -7.57755,16.50343 -2.35708,3.47535 -2.62989,4.5957 -0.797174,3.27376 0.702962,-0.50705 5.465462,-3.75071 10.583333,-7.20813 z m 31.143844,-34.15948 c -5.938088,-0.99401 -14.111111,-4.8697 -14.111111,-6.69155 0,-0.74124 0.34698,-0.90606 1.175926,-0.55859 13.750249,5.76371 25.674534,6.30576 38.84574,1.76584 5.19823,-1.79176 5.67145,-1.85348 5.67145,-0.7398 0,1.58443 -6.00576,4.44861 -11.98565,5.71603 -4.123348,0.87394 -15.628748,1.17223 -19.596355,0.50807 z M 67.491019,110.27644 c -2.731605,-1.34621 -4.164853,-3.97716 -4.164853,-7.64522 0,-2.27517 0.420505,-3.208899 2.284656,-5.073051 1.872949,-1.872949 2.793236,-2.284656 5.106878,-2.284656 2.313642,0 3.233929,0.411707 5.106878,2.284656 1.872206,1.872209 2.284656,2.793631 2.284656,5.104001 0,3.52474 -1.651633,6.39648 -4.439753,7.71953 -2.678403,1.27099 -3.411237,1.25851 -6.178462,-0.10526 z m 37.777691,0.49846 c -2.55141,-1.07854 -4.98508,-4.65476 -4.98236,-7.32146 0.007,-6.740195 7.11992,-10.581263 11.99631,-6.478042 5.40485,4.547882 3.25353,12.954022 -3.59935,14.064202 -1.10873,0.17961 -2.6453,0.0605 -3.4146,-0.2647 z M 55.262674,60.722496 c 0,-0.154646 -1.014948,-0.908447 -2.25544,-1.675113 -1.240492,-0.766666 -3.074737,-2.213235 -4.076099,-3.214597 -1.63322,-1.633221 -1.776002,-2.14535 -1.386893,-4.974505 0.537009,-3.904526 -0.823996,-6.892509 -3.576557,-7.852057 -4.264486,-1.486607 -8.191783,1.250173 -8.191783,5.708538 0,3.094194 3.053771,6.241289 6.056209,6.241289 1.320156,0 2.551318,0.51593 3.243488,1.359213 1.355602,1.651555 10.187075,5.472314 10.187075,4.407232 z"
id="path179"
inkscape:export-filename="path2_.svg"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100" /><path
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke-width:1.34112"
d="m 197.8156,226.74124 c -8.25478,-3.04445 -23.55905,-11.18647 -25.55853,-13.59737 -2.44173,-2.94415 -9.51068,-5.94042 -14.01495,-5.94042 -6.05295,0 -13.96734,-5.11225 -18.26377,-11.79739 -3.5042,-5.45244 -3.97932,-7.27004 -3.50392,-13.40427 0.58394,-7.53471 3.23697,-12.24459 9.55387,-16.96083 5.23466,-3.90824 17.91215,-3.8769 23.19009,0.0573 7.34751,5.47688 9.15093,10.51741 9.15093,25.5767 0,11.70143 0.39678,14.18674 2.78346,17.43459 2.47061,3.36208 12.54051,11.64558 22.04538,18.13454 4.01238,2.73925 1.36076,2.98415 -5.38256,0.49713 z"
id="path1563"
transform="scale(0.26458333)" /></g></svg>

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
web/dist/favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

16
web/dist/index.html vendored Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GPT4All - WEBUI</title>
<script type="module" crossorigin src="/assets/index-219239d4.js"></script>
<link rel="stylesheet" href="/assets/index-56a2d3b5.css">
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@ -2,67 +2,61 @@
<div class="flex-none sticky bottom-0 p-6 items-center justify-center self-center right-0 left-0 ">
<form>
<label for="chat" class="sr-only">Send message</label>
<div class="flex items-center gap-2 px-3 py-3 rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel shadow-lg ">
<div
class="flex items-center gap-2 px-3 py-3 rounded-lg bg-bg-light-tone-panel dark:bg-bg-dark-tone-panel shadow-lg ">
<textarea id="chat" rows="1"
class="block min-h-11 no-scrollbar p-2.5 w-full text-sm text-gray-900 bg-bg-light rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-bg-dark dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Send message..." @keydown.enter.exact="submitOnEnter($event)" ></textarea>
placeholder="Send message..." @keydown.enter.exact="submitOnEnter($event)"></textarea>
<button type="submit" on on-click=""
class="inline-flex justify-center p-2 rounded-full cursor-pointer hover:text-primary duration-75 active:scale-90">
<i data-feather="send" class=" w-6 h-6 m-1"></i>
<span class="sr-only">Send message</span>
</button>
</div>
</form>
</div>
</template>
<style>
</style>
<script>
import {nextTick} from 'vue'
import { nextTick } from 'vue'
import feather from 'feather-icons'
import websocket from '@/services/websocket.js';
export default {
name: 'ChatBox',
emits: ["messageSentEvent"],
setup() {
return {}
},
methods: {
sendMessageEvent(msg) {
this.$emit('messageSentEvent', msg)
},
submitOnEnter(event) {
if (event.which === 13) {
event.preventDefault(); // Prevents the addition of a new line in the text field
console.log("enter detected");
if (!event.repeat) {
// const newEvent = new Event("submit", { cancelable: true });
// event.target.form.dispatchEvent(newEvent);
console.log(event.target.value)
console.log(websocket)
websocket.emit('generate_msg',{prompt: event.target.value});
this.sendMessageEvent(event.target.value)
event.target.value="" // Clear input field
}
}
},
submit(event){
event.preventDefault(); // Prevents the addition of a new line in the text field
websocket.emit('generate_msg',{prompt: event.target.value});
}
},mounted(){
nextTick(()=>{
feather.replace()
})
},
mounted() {
nextTick(() => {
feather.replace()
})
},
activated(){
activated() {
}
}
</script>
<script setup>
</script>

View File

@ -4,7 +4,7 @@
// All websocket stuff can be found here.
import io from 'socket.io-client';
const socket = new io('http://' + document.domain + ':' + location.port);
const socket = new io(import.meta.env.VITE_GPT4ALL_API );
socket.onopen = () => {
console.log('WebSocket connection established.');

View File

@ -68,11 +68,11 @@
<!-- CHAT AREA -->
<div>
<Message v-for="(msg, index) in discussionArr" :key="index" :message="msg"
@click="scrollToElement($event.target)" />
@click="scrollToElement($event.target)" :id="'msg-' + msg.id" />
<WelcomeComponent v-if="discussionArr.length < 1" />
<ChatBox v-if="discussionArr.length > 1" />
<ChatBox v-if="discussionArr.length > 1" @messageSentEvent="sendMsg" />
</div>
@ -89,6 +89,10 @@
import io from 'socket.io-client';
import axios from "axios";
import { nextTick } from 'vue'
axios.defaults.baseURL = '/api/';
import websocket from '@/services/websocket.js';
export default {
setup() {
@ -163,21 +167,71 @@ export default {
},
scrollToElement(el) {
if (el) {
el.scrollIntoView({ behavior: 'smooth', block: "center", inline: "nearest" });
}
}
},
createMsg(msgObj) {
// From websocket.on("infos")
// Create user input message
let usrMessage = {
content: msgObj.message,
id: msgObj.message,
//parent: 10,
rank: 0,
sender: msgObj.user,
//type: 0
}
this.discussionArr.push(usrMessage)
nextTick(() => {
const userMsgElement = document.getElementById('msg-' + msgObj.message)
this.scrollToElement(userMsgElement)
})
// Create response message
let responseMessage = {
content: "..typing",
id: msgObj.response_id,
//parent: 10,
rank: 0,
sender: msgObj.bot,
//type: 0
}
this.discussionArr.push(responseMessage)
nextTick(() => {
const responseMessageElement = document.getElementById('msg-' + msgObj.response_id)
this.scrollToElement(responseMessageElement)
})
},
sendMsg(msg) {
//console.log("Message sent:", msg)
websocket.emit('generate_msg', { prompt: msg });
},
steamMessageContent(content) {
//console.log("Message obj recieved:", content)
const lastMsg = this.discussionArr[this.discussionArr.length - 1]
lastMsg.content = content.data
},
},
async mounted() {
async created() {
// Constructor
this.list = await this.list_discussions()
this.tempList = this.list
nextTick(() => {
feather.replace()
})
// WebSocket responses
websocket.on("infos", this.createMsg)
websocket.on("message", this.steamMessageContent)
}, components: {
Discussion,
Message,

View File

@ -20,9 +20,9 @@ export default defineConfig({
server: {
proxy: {
"/api/": {
target: process.env.GPT4ALL_API,
changeOrigin: process.env.GPT4ALL_API_CHANGE_ORIGIN,
secure: process.env.GPT4ALL_API_SECURE,
target: process.env.VITE_GPT4ALL_API,
changeOrigin: process.env.VITE_GPT4ALL_API_CHANGE_ORIGIN,
secure: process.env.VITE_GPT4ALL_API_SECURE,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},