Skip to content

Commit fb9869f

Browse files
committed
Add support for ImageToText
1 parent 77d7f3f commit fb9869f

File tree

9 files changed

+738
-34
lines changed

9 files changed

+738
-34
lines changed

AiServer/wwwroot/Ui.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default {
6262
</a>
6363
</div>
6464
<div class="hidden sm:-my-px sm:ml-2 lg:ml-4 sm:flex sm:space-x-4 xl:space-x-6">
65-
<a v-href="{admin:section.id}" v-for="section in sections"
65+
<a v-href="{admin:section.id,id:undefined}" v-for="section in sections"
6666
:class="['inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium', routes.admin==section.id ? 'border-indigo-500 text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700']" aria-current="page">
6767
<span class="lg:hidden xl:inline mr-2" :title="section.label">
6868
<img :src="section.icon" class="w-6 h-6" :alt="section.label">
@@ -120,7 +120,7 @@ export default {
120120
<div class="sm:hidden" id="mobile-menu">
121121
<div class="space-y-1 pb-3 pt-2">
122122
<!-- Current: "border-indigo-500 bg-indigo-50 text-indigo-700", Default: "border-transparent text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800" -->
123-
<a v-href="{admin:section.id}" v-for="section in sections"
123+
<a v-href="{admin:section.id,id:undefined}" v-for="section in sections"
124124
:class="['block border-l-4 py-2 pl-3 pr-4 text-base font-medium', routes.admin==section.id
125125
? 'border-indigo-500 bg-indigo-50 text-indigo-700'
126126
: 'border-transparent text-gray-600 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-800']" aria-current="page">

AiServer/wwwroot/css/app.css

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,10 @@ select{
911911
left: 1.5rem;
912912
}
913913

914+
.left-8 {
915+
left: 2rem;
916+
}
917+
914918
.left-\[calc\(50\%\+3rem\)\] {
915919
left: calc(50% + 3rem);
916920
}
@@ -955,6 +959,10 @@ select{
955959
top: 1.5rem;
956960
}
957961

962+
.top-8 {
963+
top: 2rem;
964+
}
965+
958966
.top-\[calc\(100\%-13rem\)\] {
959967
top: calc(100% - 13rem);
960968
}
@@ -1078,6 +1086,10 @@ select{
10781086
margin-bottom: -1px;
10791087
}
10801088

1089+
.-ml-0\.5 {
1090+
margin-left: -0.125rem;
1091+
}
1092+
10811093
.-ml-1 {
10821094
margin-left: -0.25rem;
10831095
}
@@ -1318,6 +1330,10 @@ select{
13181330
height: 1rem;
13191331
}
13201332

1333+
.h-48 {
1334+
height: 12rem;
1335+
}
1336+
13211337
.h-5 {
13221338
height: 1.25rem;
13231339
}
@@ -1326,6 +1342,10 @@ select{
13261342
height: 1.5rem;
13271343
}
13281344

1345+
.h-64 {
1346+
height: 16rem;
1347+
}
1348+
13291349
.h-7 {
13301350
height: 1.75rem;
13311351
}
@@ -1988,6 +2008,10 @@ select{
19882008
border-top-width: 1px;
19892009
}
19902010

2011+
.border-dashed {
2012+
border-style: dashed;
2013+
}
2014+
19912015
.border-dotted {
19922016
border-style: dotted;
19932017
}
@@ -2001,6 +2025,11 @@ select{
20012025
border-color: rgb(96 165 250 / var(--tw-border-opacity));
20022026
}
20032027

2028+
.border-blue-500 {
2029+
--tw-border-opacity: 1;
2030+
border-color: rgb(59 130 246 / var(--tw-border-opacity));
2031+
}
2032+
20042033
.border-gray-100 {
20052034
--tw-border-opacity: 1;
20062035
border-color: rgb(243 244 246 / var(--tw-border-opacity));
@@ -2316,14 +2345,6 @@ select{
23162345
fill: #4b5563;
23172346
}
23182347

2319-
.fill-indigo-600 {
2320-
fill: #4f46e5;
2321-
}
2322-
2323-
.stroke-indigo-600 {
2324-
stroke: #4f46e5;
2325-
}
2326-
23272348
.object-cover {
23282349
-o-object-fit: cover;
23292350
object-fit: cover;
@@ -3132,6 +3153,10 @@ select{
31323153
--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity));
31333154
}
31343155

3156+
.ring-transparent {
3157+
--tw-ring-color: transparent;
3158+
}
3159+
31353160
.ring-opacity-5 {
31363161
--tw-ring-opacity: 0.05;
31373162
}
@@ -3594,6 +3619,14 @@ select{
35943619
outline-offset: 2px;
35953620
}
35963621

3622+
.focus\:outline:focus {
3623+
outline-style: solid;
3624+
}
3625+
3626+
.focus\:outline-indigo-700:focus {
3627+
outline-color: #4338ca;
3628+
}
3629+
35973630
.focus\:ring-0:focus {
35983631
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
35993632
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
@@ -3652,6 +3685,11 @@ select{
36523685
--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity));
36533686
}
36543687

3688+
.focus\:ring-indigo-700:focus {
3689+
--tw-ring-opacity: 1;
3690+
--tw-ring-color: rgb(67 56 202 / var(--tw-ring-opacity));
3691+
}
3692+
36553693
.focus\:ring-offset-1:focus {
36563694
--tw-ring-offset-width: 1px;
36573695
}

AiServer/wwwroot/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<title>Admin</title>
55
<link rel="icon" type="image/svg" href="/img/logo.svg">
66
<link rel="stylesheet" href="/css/app.css">
7+
<link rel="stylesheet" href="/css/typography.css">
8+
<link rel="stylesheet" href="/css/highlight.css">
79
<style>
810
::-webkit-scrollbar { width: 8px; height: 8px }
911
::-webkit-scrollbar-thumb { background-color: #ccc }

AiServer/wwwroot/mjs/components/Chat.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { ref, computed, onMounted, inject, watch, nextTick } from "vue"
22
import { useFormatters, useClient } from "@servicestack/vue"
33
import { marked } from "../markdown.mjs"
44
import { addCopyButtonToCodeBlocks } from "../dom.mjs"
5-
import { useUiLayout, UiLayout, ThreadStorage, HistoryGroups } from "../utils.mjs"
5+
import {useUiLayout, UiLayout, ThreadStorage, HistoryTitle, HistoryGroups } from "../utils.mjs"
66
import { QueryPrompts, ActiveAiModels, OpenAiChatCompletion } from "dtos"
77

88
export default {
99
components: {
1010
UiLayout,
11+
HistoryTitle,
1112
HistoryGroups,
1213
},
1314
template: `
@@ -74,7 +75,7 @@ export default {
7475
<div class="fixed bottom-0 md:pt-2 dark:border-white/20 md:border-transparent md:dark:border-transparent bg-white pr-8" style="width:calc(max(100% - 18rem - 18rem - 2.25rem, 30rem))">
7576
<div class="text-base px-3 md:px-4 m-auto md:px-5 lg:px-1 xl:px-5">
7677
<div class="flex flex-1 gap-4 text-base md:gap-5 lg:gap-6 md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem]">
77-
<form class="w-full" type="button" @submit.prevent="send">
78+
<form class="w-full" @submit.prevent="send">
7879
<div class="relative flex h-full max-w-full flex-1 flex-col">
7980
<div class="absolute bottom-full left-0 right-0 z-20">
8081
<div class="relative h-full w-full">
@@ -109,7 +110,7 @@ export default {
109110
</template>
110111
111112
<template #sidebar>
112-
<h3 class="p-2 sm:block text-xl md:text-2xl font-semibold">History</h3>
113+
<HistoryTitle :prefix="storage.prefix" />
113114
<HistoryGroups :history="history" v-slot="{ item }" @save="saveHistoryItem($event)" @remove="removeHistoryItem($event)">
114115
<Icon class="h-4 w-4 flex-shrink-0 mr-1" :src="item.icon" loading="lazy" :alt="item.model" />
115116
<span :title="item.title">{{item.title}}</span>
@@ -196,7 +197,9 @@ export default {
196197
if (r?.id) {
197198
console.debug(`${storage.prefix}.response`, r)
198199

200+
const id = parseInt(routes.id) || storage.createId()
199201
thread.value = thread.value ?? storage.createThread(Object.assign({
202+
id: storage.getThreadId(id),
200203
title: prefs.value.userContent,
201204
model: prefs.value.model,
202205
prompt: prefs.value.prompt,
@@ -224,7 +227,6 @@ export default {
224227
thread.value.messages = msgs
225228
saveThread()
226229

227-
const id = parseInt(routes.id) || storage.createId()
228230
if (!history.value.find(x => x.id === id)) {
229231
history.value.push({
230232
id,
@@ -362,7 +364,7 @@ export default {
362364
})
363365

364366
return {
365-
client, routes, refUi, showChatMenu, renameChatId, prefs, validPrompt,
367+
storage, client, routes, refUi, showChatMenu, renameChatId, prefs, validPrompt,
366368
thread, history, models, prompts, error, systemPrompt, showSystemPrompt,
367369
selectedPrompt, refMessage,
368370
marked, send, selectPrompt, saveHistoryItem, removeHistoryItem,

0 commit comments

Comments
 (0)