From babaa0a72c964d9e0d28f0f73e10aec5a2e68157 Mon Sep 17 00:00:00 2001 From: Owen Wu Date: Wed, 5 Apr 2023 12:08:59 +0800 Subject: [PATCH 1/6] feat: config plugins --- src/ChatConfigWindow.tsx | 10 ++++++++++ src/types.ts | 25 +++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/ChatConfigWindow.tsx b/src/ChatConfigWindow.tsx index 27ce732f..6924c2cd 100644 --- a/src/ChatConfigWindow.tsx +++ b/src/ChatConfigWindow.tsx @@ -52,6 +52,16 @@ export default function ChatConfigWindow(props: Props) { value={dataEdit.name} onChange={(e) => setDataEdit({ ...dataEdit, name: e.target.value })} /> + setDataEdit({ ...dataEdit, plugins: [] })} + /> diff --git a/src/types.ts b/src/types.ts index c9d4f30c..65baae5d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -import {ChatCompletionRequestMessage, ChatCompletionRequestMessageRoleEnum} from './utils/openai-node/api' +import { ChatCompletionRequestMessage, ChatCompletionRequestMessageRoleEnum } from './utils/openai-node/api' import { v4 as uuidv4 } from 'uuid'; import { ThemeMode } from './theme'; @@ -7,11 +7,32 @@ export type Message = ChatCompletionRequestMessage & { cancel?: () => void; } -export interface Session{ +export interface Plugin { + schema_version: string; + name_for_model: string; + name_for_human: string; + description_for_model: string; + description_for_human: string; + auth: { + type: string; + authorization_type: string; + }; + api: { + type: string; + url: string; + has_user_authentication: boolean; + }; + logo_url: string; + contact_email: string; + legal_info_url: string; +} + +export interface Session { id: string name: string messages: Message[] model: string + plugins?: Plugin[] } export function createMessage(role: ChatCompletionRequestMessageRoleEnum = ChatCompletionRequestMessageRoleEnum.User, content: string = ''): Message { From efc4cd20a6581203878dc2021ff5b4deb0d5c240 Mon Sep 17 00:00:00 2001 From: Owen Wu Date: Wed, 5 Apr 2023 17:35:37 +0800 Subject: [PATCH 2/6] feat: add retrieval plugin --- src/ChatConfigWindow.tsx | 87 +++++++++++++++++++---- src/SessionItem.tsx | 4 +- src/i18n/locales/en/translation.json | 1 + src/i18n/locales/zh-Hans/translation.json | 1 + src/i18n/locales/zh-Hant/translation.json | 1 + src/store.ts | 48 +++++++++++-- src/types.ts | 3 +- 7 files changed, 125 insertions(+), 20 deletions(-) diff --git a/src/ChatConfigWindow.tsx b/src/ChatConfigWindow.tsx index 6924c2cd..1d9bbee2 100644 --- a/src/ChatConfigWindow.tsx +++ b/src/ChatConfigWindow.tsx @@ -1,12 +1,36 @@ import React from 'react'; import { Button, Dialog, DialogContent, DialogActions, DialogTitle, DialogContentText, TextField, + OutlinedInput,InputLabel,Chip,FormControl,Select,Box,MenuItem } from '@mui/material'; -import { Session } from './types' +import { SelectChangeEvent } from '@mui/material/Select'; +import { Theme, useTheme } from '@mui/material/styles'; +import useStore from './store' +import { Session, Plugin } from './types' import { useTranslation } from "react-i18next"; +const ITEM_HEIGHT = 48; +const ITEM_PADDING_TOP = 8; +const MenuProps = { + PaperProps: { + style: { + maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, + width: 250, + }, + }, +}; + const { useEffect } = React +function getStyles(name: string, pluginIDs: readonly string[], theme: Theme) { + return { + fontWeight: + pluginIDs.indexOf(name) === -1 + ? theme.typography.fontWeightRegular + : theme.typography.fontWeightMedium, + }; + } + interface Props { open: boolean session: Session @@ -15,13 +39,29 @@ interface Props { } export default function ChatConfigWindow(props: Props) { + const theme = useTheme(); const { t } = useTranslation() + const { plugins } = useStore() + const [dataEdit, setDataEdit] = React.useState(props.session); useEffect(() => { setDataEdit(props.session) }, [props.session]) + const [pluginIDs, setPluginIDs] = React.useState(props.session.pluginIDs?props.session.pluginIDs:[]); + + const handleChange = (event: SelectChangeEvent) => { + const { + target: { value }, + } = event; + + setPluginIDs( + // On autofill we get a stringified value. + typeof value === 'string' ? value.split(',') : value, + ); + }; + const onCancel = () => { props.close() setDataEdit(props.session) @@ -32,14 +72,16 @@ export default function ChatConfigWindow(props: Props) { dataEdit.name = props.session.name } dataEdit.name = dataEdit.name.trim() + dataEdit.pluginIDs = pluginIDs + props.save(dataEdit) props.close() } return ( - {t('rename')} - + {t('edit session')} + setDataEdit({ ...dataEdit, name: e.target.value })} /> - setDataEdit({ ...dataEdit, plugins: [] })} - /> + + Plugins + + diff --git a/src/SessionItem.tsx b/src/SessionItem.tsx index e486c745..2a3db201 100644 --- a/src/SessionItem.tsx +++ b/src/SessionItem.tsx @@ -50,7 +50,7 @@ export default function SessionItem(props: Props) { - {session.name} + {session.name}{(session.pluginIDs && session.pluginIDs.length > 0) ? "^": ""} @@ -69,7 +69,7 @@ export default function SessionItem(props: Props) { handleClose() }} disableRipple> - {t('rename')} + {t('edit session')} { diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 1059a310..6eec213d 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -35,6 +35,7 @@ "[Enter] send, [Shift+Enter] line break, [Ctrl+Enter] send without generating": "[Enter] send, [Shift+Enter] line break, [Ctrl+Enter] send without generating", "version": "Version", "rename": "Rename", + "edit session": "Edit Session", "name": "Name", "clean": "Clean", "this action will permanently delete all non-system messages in": "This action will permanently delete all non-system messages in", diff --git a/src/i18n/locales/zh-Hans/translation.json b/src/i18n/locales/zh-Hans/translation.json index bf2e0cb2..4cde66da 100644 --- a/src/i18n/locales/zh-Hans/translation.json +++ b/src/i18n/locales/zh-Hans/translation.json @@ -34,6 +34,7 @@ "[Enter] send, [Shift+Enter] line break, [Ctrl+Enter] send without generating": "[回车键] 发送,[Shift+回车键] 换行, [Ctrl+回车键] 发送但不生成", "version": "版本", "rename": "重命名", + "edit session": "编辑会话", "name": "名称", "clean": "清空", "this action will permanently delete all non-system messages in": "此操作将永久删除", diff --git a/src/i18n/locales/zh-Hant/translation.json b/src/i18n/locales/zh-Hant/translation.json index d9587f5d..18b8acdc 100644 --- a/src/i18n/locales/zh-Hant/translation.json +++ b/src/i18n/locales/zh-Hant/translation.json @@ -35,6 +35,7 @@ "[Enter] send, [Shift+Enter] line break, [Ctrl+Enter] send without generating": "[Enter] 傳送、[Shift+Enter] 換行、[Ctrl+Enter] 傳送但不產生", "version": "版本", "rename": "改名", + "edit session": "編輯對話", "name": "名稱", "clean": "清除", "this action will permanently delete all non-system messages in": "此動作將永久刪除", diff --git a/src/store.ts b/src/store.ts index 882d11ae..2eb4a903 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { Settings, createSession, Session, Message } from './types' +import { Settings, createSession, Session, Message, Plugin } from './types' import * as defaults from './defaults' import * as openai from './utils/openai-node' import { v4 as uuidv4 } from 'uuid'; @@ -24,8 +24,31 @@ export function getDefaultSettings(): Settings { } } +export const defaultPlugins: Plugin[] = [ + { + "id": "chatgpt-retrieval-plugin", + "schema_version": "v1", + "name_for_model": "retrieval", + "name_for_human": "Retrieval Plugin", + "description_for_model": "Plugin for searching through the user's documents (such as files, emails, and more) to find answers to questions and retrieve relevant information. Use it whenever a user asks something that might be found in their personal information.", + "description_for_human": "Search through your documents.", + "auth": { + "type": "user_http", + "authorization_type": "bearer" + }, + "api": { + "type": "openapi", + "url": "http://127.0.0.1:8080/.well-known/openapi.yaml", + "has_user_authentication": false + }, + "logo_url": "https://your-app-url.com/.well-known/logo.png", + "contact_email": "hello@contact.com", + "legal_info_url": "http://example.com/legal-info" + } +] + export async function readSettings(): Promise { - const setting: Settings|undefined = await api.readStore('settings') + const setting: Settings | undefined = await api.readStore('settings') if (!setting) { return getDefaultSettings() } @@ -147,10 +170,23 @@ export default function useStore() { }) } - const [toasts, _setToasts] = useState<{id: string, content: string}[]>([]) + + const [plugins, setPlugins] = useState(defaultPlugins) + const installPlugin = (plugin: Plugin) => { + setPlugins((plugins: Plugin[]) => { + return plugins.concat(plugin) + }) + } + const uninstallPlugin = (pluginId: string) => { + setPlugins((plugins: Plugin[]) => { + return plugins.filter((plugin: Plugin) => { plugin.id !== pluginId }) + }) + } + + const [toasts, _setToasts] = useState<{ id: string, content: string }[]>([]) const addToast = (content: string) => { const id = uuidv4() - _setToasts([...toasts, {id, content}]) + _setToasts([...toasts, { id, content }]) } const removeToast = (id: string) => { _setToasts(toasts.filter((t) => t.id !== id)) @@ -169,6 +205,10 @@ export default function useStore() { deleteChatSession, createEmptyChatSession, + plugins, + installPlugin, + uninstallPlugin, + currentSession, switchCurrentSession, diff --git a/src/types.ts b/src/types.ts index 65baae5d..f73183f1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -8,6 +8,7 @@ export type Message = ChatCompletionRequestMessage & { } export interface Plugin { + id: string; schema_version: string; name_for_model: string; name_for_human: string; @@ -32,7 +33,7 @@ export interface Session { name: string messages: Message[] model: string - plugins?: Plugin[] + pluginIDs?: string[] } export function createMessage(role: ChatCompletionRequestMessageRoleEnum = ChatCompletionRequestMessageRoleEnum.User, content: string = ''): Message { From 10f8f6305d21d21567b6adef0ca4f232d73fa50c Mon Sep 17 00:00:00 2001 From: Owen Wu Date: Wed, 5 Apr 2023 21:18:51 +0800 Subject: [PATCH 3/6] feat: ok for plugin tasks --- src/App.tsx | 60 +++++++++++++++++++++++++++++-- src/pluginTasks.ts | 88 ++++++++++++++++++++++++++++++++++++++++++++++ src/store.ts | 66 ++++++++++++++++++++++++++-------- src/types.ts | 11 ++++++ 4 files changed, 208 insertions(+), 17 deletions(-) create mode 100644 src/pluginTasks.ts diff --git a/src/App.tsx b/src/App.tsx index e37ffed5..349f9cfe 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -23,6 +23,7 @@ import * as api from './api'; import { ThemeSwitcherProvider } from './theme/ThemeSwitcher'; import { useTranslation } from "react-i18next"; import icon from './icon.png' +import { applyPlugins } from './pluginTasks'; const { useEffect, useState } = React @@ -191,6 +192,55 @@ function Main() { messageScrollRef.current = null } + const generateWithPlugins = async (session: Session, pluginIDs: string[], promptMsgs: Message[], targetMsg: Message) => { + messageScrollRef.current = { msgId: targetMsg.id, smooth: false } + + targetMsg.content = "正在收集信息..." + + let pluginMsg = await applyPlugins(store.plugins, pluginIDs, promptMsgs[promptMsgs.length - 1]) + if (pluginMsg) { + promptMsgs = promptMsgs.slice(0, promptMsgs.length - 2).concat(pluginMsg, promptMsgs[promptMsgs.length - 1]) + } + + targetMsg.content = "正在生成结果..." + + await client.replay( + store.settings.openaiKey, + store.settings.apiHost, + store.settings.maxContextSize, + store.settings.maxTokens, + session.model, + promptMsgs, + ({ text, cancel }) => { + for (let i = 0; i < session.messages.length; i++) { + if (session.messages[i].id === targetMsg.id) { + session.messages[i] = { + ...session.messages[i], + content: text, + cancel, + } + + break; + } + } + store.updateChatSession(session) + }, + (err) => { + for (let i = 0; i < session.messages.length; i++) { + if (session.messages[i].id === targetMsg.id) { + session.messages[i] = { + ...session.messages[i], + content: t('api request failed:') + ' \n```\n' + err.message + '\n```', + } + break + } + } + store.updateChatSession(session) + } + ) + messageScrollRef.current = null + } + const [messageInput, setMessageInput] = useState('') useEffect(() => { document.getElementById('message-input')?.focus() // better way? @@ -419,7 +469,13 @@ function Main() { const newAssistantMsg = createMessage('assistant', '....') store.currentSession.messages = [...store.currentSession.messages, newUserMsg, newAssistantMsg] store.updateChatSession(store.currentSession) - generate(store.currentSession, promptsMsgs, newAssistantMsg) + + if (store.currentSession.pluginIDs && store.currentSession.pluginIDs.length>0) { + generateWithPlugins(store.currentSession, store.currentSession.pluginIDs, promptsMsgs, newAssistantMsg) + } else { + generate(store.currentSession, promptsMsgs, newAssistantMsg) + } + messageScrollRef.current = { msgId: newAssistantMsg.id, smooth: true } } else { store.currentSession.messages = [...store.currentSession.messages, newUserMsg] @@ -445,7 +501,7 @@ function Main() { { - store.updateChatSession(session) + store.updateChatSessionPlugins(session) setConfigureChatConfig(null) }} close={() => setConfigureChatConfig(null)} diff --git a/src/pluginTasks.ts b/src/pluginTasks.ts new file mode 100644 index 00000000..1fa1a123 --- /dev/null +++ b/src/pluginTasks.ts @@ -0,0 +1,88 @@ +import { Message, createMessage, Plugin } from './types'; + +export interface QueryResult { + results: Array<{ + query: string; + results: Array<{ + id: string; + text: string; + metadata: { + source: string; + source_id: string; + url: string; + created_at: string; + author: string; + document_id: string; + }; + embedding: number[]; + score: number; + }>; + }>; +} + +export async function applyPlugins( + plugins: Plugin[], + pluginIDs: string[], + userMsg: Message +): Promise { + let pluginMsg = createMessage("system", "") + pluginMsg.tags = ["plugin_content"] + + console.log("applyPlugins plugins:", plugins, "pluginIDs:", pluginIDs) + + let ret = plugins.filter((plugin: Plugin) => {return pluginIDs.indexOf(plugin.id) >= 0}) + console.log("applyPlugins return:", ret) + + if (ret && ret.length>0) { + let content = await applyPlugin(ret[0], userMsg) + if (content) { + pluginMsg.content = `可以参考插件获取的如下内容回复用户问题,内容如下:${content}` + } + } + + console.log("pluginMsg:", pluginMsg) + + return pluginMsg +} + +export async function applyPlugin( + plugin: Plugin, + userMsg: Message +): Promise { + try { + const response = await fetch(`http://127.0.0.1:8080/sub/query`, { + method: 'POST', + headers: { + 'Authorization': `${plugin.auth.authorization_type} ${plugin.auth.authorization_token}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + "queries": [ + { + "query": userMsg.content, + "top_k": 3 + } + ] + }), + }); + + if (!response.body) { + throw new Error('No response body') + } + + let msgContent = ''; + + const result = await response.json() as QueryResult + console.log("query result:", result) + + if (result && result.results) { + for (let chunk of result.results[0].results) { + msgContent += chunk.text + "\n" + } + } + + return msgContent + } catch (error) { + throw error + } +} diff --git a/src/store.ts b/src/store.ts index 2eb4a903..7b54a35f 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { Settings, createSession, Session, Message, Plugin } from './types' +import { Settings, createSession, Session, createMessage, Message, messageHasTag, Plugin } from './types' import * as defaults from './defaults' import * as openai from './utils/openai-node' import { v4 as uuidv4 } from 'uuid'; @@ -34,7 +34,8 @@ export const defaultPlugins: Plugin[] = [ "description_for_human": "Search through your documents.", "auth": { "type": "user_http", - "authorization_type": "bearer" + "authorization_type": "Bearer", + "authorization_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik93ZW4gV3UiLCJpYXQiOjE1MTYyMzkwMjJ9.6Wai0ClBOxd40SUG0kaK7gn41N6ZVt4VM54Buzc5hUE", }, "api": { "type": "openapi", @@ -119,6 +120,26 @@ export default function useStore() { i18n.changeLanguage(settings.language).then(); } + const [plugins, setPlugins] = useState(defaultPlugins) + const installPlugin = (plugin: Plugin) => { + setPlugins((plugins: Plugin[]) => { + return plugins.concat(plugin) + }) + } + const uninstallPlugin = (pluginId: string) => { + setPlugins((plugins: Plugin[]) => { + return plugins.filter((plugin: Plugin) => { plugin.id !== pluginId }) + }) + } + const getPluginByID = (plugins: Plugin[], pluginId: string): Plugin | undefined => { + let result = plugins.filter(plugin => plugin.id === pluginId) + if (result && result.length > 0) { + return result[0] + } + + return undefined + } + const [chatSessions, _setChatSessions] = useState([createSession(settings.model)]) const [currentSession, switchCurrentSession] = useState(chatSessions[0]) useEffect(() => { @@ -142,6 +163,33 @@ export default function useStore() { } setSessions(sessions) } + + const updateChatSessionPlugins = (session: Session) => { + console.log("updatePluginSystemPromot:", session) + + if (session.pluginIDs && session.pluginIDs.length>0) { + const messages = session.messages.filter(msg => msg.role === 'system' && !messageHasTag(msg, "plugin")) + + let pluginPromt = `为了完成你的任务,你可以使用插件提供的功能,这里有${session.pluginIDs.length}个插件: ` + + for (let pluginId of session.pluginIDs) { + let plugin = getPluginByID(plugins, pluginId) + if (plugin) { + pluginPromt += `\n` + pluginPromt += `插件名称:${plugin.name_for_model} \n` + pluginPromt += `插件描述:${plugin.description_for_model} \n` + } + } + + messages.push(createMessage("system", pluginPromt), ...session.messages.filter(msg => msg.role !== 'system')) + + updateChatSession({ ...session, messages }) + return + } + + updateChatSession(session) + } + const updateChatSession = (session: Session) => { const sessions = chatSessions.map((s) => { if (s.id === session.id) { @@ -170,19 +218,6 @@ export default function useStore() { }) } - - const [plugins, setPlugins] = useState(defaultPlugins) - const installPlugin = (plugin: Plugin) => { - setPlugins((plugins: Plugin[]) => { - return plugins.concat(plugin) - }) - } - const uninstallPlugin = (pluginId: string) => { - setPlugins((plugins: Plugin[]) => { - return plugins.filter((plugin: Plugin) => { plugin.id !== pluginId }) - }) - } - const [toasts, _setToasts] = useState<{ id: string, content: string }[]>([]) const addToast = (content: string) => { const id = uuidv4() @@ -202,6 +237,7 @@ export default function useStore() { chatSessions, createChatSession, updateChatSession, + updateChatSessionPlugins, deleteChatSession, createEmptyChatSession, diff --git a/src/types.ts b/src/types.ts index f73183f1..62e63246 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,6 +5,15 @@ import { ThemeMode } from './theme'; export type Message = ChatCompletionRequestMessage & { id: string; cancel?: () => void; + tags?: string[]; +} + +export function messageHasTag(msg: Message, tag: string = "Untitled"): boolean { + if (!msg.tags) { + return false + } + + return msg.tags.indexOf(tag) > -1 } export interface Plugin { @@ -17,6 +26,7 @@ export interface Plugin { auth: { type: string; authorization_type: string; + authorization_token?: string; }; api: { type: string; @@ -44,6 +54,7 @@ export function createMessage(role: ChatCompletionRequestMessageRoleEnum = ChatC } } + export function createSession(modelName: string, name: string = "Untitled"): Session { return { id: uuidv4(), From 3db345363cc8f5e88a4e101b0d9e41c1805bbed2 Mon Sep 17 00:00:00 2001 From: Owen Wu Date: Fri, 7 Apr 2023 23:56:47 +0800 Subject: [PATCH 4/6] feat: config plugins --- package.json | 2 +- src-tauri/tauri.conf.json | 2 +- src/pluginTasks.ts | 4 ++-- src/store.ts | 23 ++++++++++++++++++++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7b1316b2..0f227076 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "chatbox", "productName": "chatbox", - "version": "0.0.1", + "version": "0.4.0", "private": true, "description": "a cross-platform desktop client for ChatGPT API (OpenAI API)", "scripts": { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b54573b3..1e8d782d 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "chatbox", - "version": "0.0.1" + "version": "0.4.0" }, "tauri": { "allowlist": { diff --git a/src/pluginTasks.ts b/src/pluginTasks.ts index 1fa1a123..cd3e26d4 100644 --- a/src/pluginTasks.ts +++ b/src/pluginTasks.ts @@ -50,7 +50,7 @@ export async function applyPlugin( userMsg: Message ): Promise { try { - const response = await fetch(`http://127.0.0.1:8080/sub/query`, { + const response = await fetch(`${plugin.api.url}/sub/query`, { method: 'POST', headers: { 'Authorization': `${plugin.auth.authorization_type} ${plugin.auth.authorization_token}`, @@ -60,7 +60,7 @@ export async function applyPlugin( "queries": [ { "query": userMsg.content, - "top_k": 3 + "top_k": 5 } ] }), diff --git a/src/store.ts b/src/store.ts index 7b54a35f..6b563031 100644 --- a/src/store.ts +++ b/src/store.ts @@ -39,7 +39,28 @@ export const defaultPlugins: Plugin[] = [ }, "api": { "type": "openapi", - "url": "http://127.0.0.1:8080/.well-known/openapi.yaml", + "url": "http://127.0.0.1:8080", + "has_user_authentication": false + }, + "logo_url": "https://your-app-url.com/.well-known/logo.png", + "contact_email": "hello@contact.com", + "legal_info_url": "http://example.com/legal-info" + }, + { + "id": "FBLG-retrieval-plugin", + "schema_version": "v1", + "name_for_model": "FBLG-retrieval", + "name_for_human": "FBLG Retrieval Plugin", + "description_for_model": "Plugin for searching through the user's documents (such as files, emails, and more) to find answers to questions and retrieve relevant information. Use it whenever a user asks something that might be found in their personal information.", + "description_for_human": "Search through your documents.", + "auth": { + "type": "user_http", + "authorization_type": "Bearer", + "authorization_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik93ZW4gV3UiLCJpYXQiOjE1MTYyMzkwMjJ9.6Wai0ClBOxd40SUG0kaK7gn41N6ZVt4VM54Buzc5hUE", + }, + "api": { + "type": "openapi", + "url": "http://127.0.0.1:8081", "has_user_authentication": false }, "logo_url": "https://your-app-url.com/.well-known/logo.png", From 69c607e916f5e7a163be4d712c2852d7f7eaf0db Mon Sep 17 00:00:00 2001 From: Owen Wu Date: Sat, 8 Apr 2023 09:18:23 +0800 Subject: [PATCH 5/6] feat: remote unuse plugin --- src/store.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/store.ts b/src/store.ts index 0456ae4f..8904f60b 100644 --- a/src/store.ts +++ b/src/store.ts @@ -44,27 +44,6 @@ export const defaultPlugins: Plugin[] = [ "logo_url": "https://your-app-url.com/.well-known/logo.png", "contact_email": "hello@contact.com", "legal_info_url": "http://example.com/legal-info" - }, - { - "id": "FBLG-retrieval-plugin", - "schema_version": "v1", - "name_for_model": "FBLG-retrieval", - "name_for_human": "FBLG Retrieval Plugin", - "description_for_model": "Plugin for searching through the user's documents (such as files, emails, and more) to find answers to questions and retrieve relevant information. Use it whenever a user asks something that might be found in their personal information.", - "description_for_human": "Search through your documents.", - "auth": { - "type": "user_http", - "authorization_type": "Bearer", - "authorization_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ik93ZW4gV3UiLCJpYXQiOjE1MTYyMzkwMjJ9.6Wai0ClBOxd40SUG0kaK7gn41N6ZVt4VM54Buzc5hUE", - }, - "api": { - "type": "openapi", - "url": "http://127.0.0.1:8081", - "has_user_authentication": false - }, - "logo_url": "https://your-app-url.com/.well-known/logo.png", - "contact_email": "hello@contact.com", - "legal_info_url": "http://example.com/legal-info" } ] From ede13929cbb4c7b9d8dcce95a234b170851916c8 Mon Sep 17 00:00:00 2001 From: Owen Wu Date: Sun, 9 Apr 2023 23:09:16 +0800 Subject: [PATCH 6/6] feat: merge from main --- src/types.ts | 1 - yarn.lock | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index be9897f3..119e150c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,3 @@ -import { ChatCompletionRequestMessage, ChatCompletionRequestMessageRoleEnum } from './utils/openai-node/api' import { v4 as uuidv4 } from 'uuid'; import { ThemeMode } from './theme'; diff --git a/yarn.lock b/yarn.lock index ff95e1e9..fff39991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4706,7 +4706,7 @@ events@^3.2.0: eventsource-parser@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/eventsource-parser/-/eventsource-parser-1.0.0.tgz#6332e37fd5512e3c8d9df05773b2bf9e152ccc04" + resolved "https://registry.npmmirror.com/eventsource-parser/-/eventsource-parser-1.0.0.tgz#6332e37fd5512e3c8d9df05773b2bf9e152ccc04" integrity sha512-9jgfSCa3dmEme2ES3mPByGXfgZ87VbP97tng1G2nWwWx6bV2nYxm2AWCrbQjXToSe+yYlqaZNtxffR9IeQr95g== execa@^5.0.0: