Skip to content

Commit

Permalink
Merge branch 'main' into improve-041712
Browse files Browse the repository at this point in the history
  • Loading branch information
sugarforever authored Apr 17, 2024
2 parents 9b5f700 + 5107de1 commit c7b5a12
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,4 @@ tmp
chroma_data

.DS_Store
yarn.lock
18 changes: 15 additions & 3 deletions assets/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@
@import 'highlight.js/scss/github-dark.scss';
}

html, body, #__nuxt {
html,
body,
#__nuxt {
height: 100%;
font-family: "Noto Sans", SF Pro SC, SF Pro Text, SF Pro Icons, PingFang SC, Helvetica Neue, Helvetica, Arial, sans-serif;
}

body {

code,
pre,
kbd,
samp {
font-family: inherit;
}
}

.md-body {
--color-neutral-muted: rgb(var(--color-primary-100));
--color-canvas-subtle: rgb(var(--color-primary-50));
Expand All @@ -32,7 +44,7 @@ html, body, #__nuxt {
list-style: initial;
}

li > p {
li>p {
display: inline;
}
}
Expand All @@ -57,4 +69,4 @@ html, body, #__nuxt {
transform: translateX(0%);
}
}
}
}
2 changes: 1 addition & 1 deletion components/ChatSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function onReset() {
<UInput v-model="state.title" maxlength="40" />
</UFormGroup>
<UFormGroup label="Model" name="model" required class="mb-4">
<ModelsSelectMenu v-model="state.model" v-model:model="currentModel" />
<ModelsSelectMenu v-model="state.model" v-model:modelInfo="currentModel" />
</UFormGroup>
<UFormGroup label="Knowledge Base" name="knowledgeBaseId" class="mb-4">
<USelectMenu v-model="state.knowledgeBaseId"
Expand Down
57 changes: 55 additions & 2 deletions components/KnowledgeBaseForm.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
<script lang="ts" setup>
import type { KnowledgeBase } from '@prisma/client'
import { OPENAI_EMBEDDING_MODELS, GEMINI_EMBEDDING_MODELS } from '@/server/utils/models'
type OperateType = 'create' | 'update'
type EmbeddingModelType = {
label: string,
value: string,
group: string,
color: string
}
const embeddings = (() => {
const embeddings_list = Array<EmbeddingModelType>()
OPENAI_EMBEDDING_MODELS.forEach((item) => {
embeddings_list.push({
label: item,
value: item,
group: 'OpenAI',
color: 'primary'
})
})
GEMINI_EMBEDDING_MODELS.forEach((item) => {
embeddings_list.push({
label: item,
value: item,
group: 'Gemini',
color: 'green'
})
})
return embeddings_list
})()
const props = defineProps<{
title: string
type: OperateType
Expand All @@ -15,7 +49,7 @@ const toast = useToast()
const state = reactive({
files: [] as File[],
name: props.data?.name || '',
embedding: props.data?.embedding || '',
embedding: props.data?.embedding || undefined,
description: props.data?.description || '',
urls: '',
pageParser: 'cheerio' as 'cheerio' | 'jinaReader'
Expand Down Expand Up @@ -101,7 +135,26 @@ async function submit(formData: FormData) {
</UFormGroup>

<UFormGroup label="Embedding" name="embedding" :required="!isModify" class="mb-4">
<UInput type="text" v-model="state.embedding" :disabled="isModify" />
<USelectMenu v-model="state.embedding"
:options="embeddings"
option-attribute="label"
value-attribute="value"
:disabled="isModify"
searchable
creatable>
<template #option="{ option }">
<span class="block truncate">
<UBadge :label="option.group" :color="option.color" size="xs" />&nbsp;
{{ option.label }}
</span>
</template>

<template #option-create="{ option }">
<span class="flex-shrink-0">Click to use embedding:</span>
<span class="flex-shrink-0 w-2 h-2 mt-px rounded-full -mx-1"></span>
<span class="block truncate text-primary">{{ option }}</span>
</template>
</USelectMenu>
</UFormGroup>

<UFormGroup label="Description" name="description" class="mb-4">
Expand Down
2 changes: 1 addition & 1 deletion components/ModelsSelectMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const props = withDefaults(defineProps<{
})
const value = defineModel<string>()
const currentModel = defineModel<ModelInfo>('model')
const currentModel = defineModel<ModelInfo>('modelInfo')
const models = await loadModels()
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
"chromadb": "^1.8.1",
"dexie": "^4.0.1",
"highlight.js": "^11.9.0",
"html-to-text": "^9.0.5",
"ioredis": "^5.3.2",
"jsdom": "^24.0.0",
"langchain": "^0.1.31",
"langsmith": "^0.1.14",
"mammoth": "^1.7.1",
Expand Down
Loading

0 comments on commit c7b5a12

Please sign in to comment.