Skip to content

WIP: Update UI to match Official Style; Vision and Assistants 👷🏽 #1190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 58 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a3eda06
wip: initial client side code
danny-avila Nov 8, 2023
a59e094
wip: initial api code
danny-avila Nov 8, 2023
a909a3f
refactor: export query keys from own module, export assistant hooks
danny-avila Nov 8, 2023
825cca2
refactor(SelectDropDown): more customization via props
danny-avila Nov 8, 2023
8c8eddc
feat: create Assistant and render real Assistants
danny-avila Nov 8, 2023
d75d3e3
refactor: major refactor of UI components to allow multi-chat, workin…
danny-avila Nov 10, 2023
92cdfc1
refactor: move assistant routes to own directory
danny-avila Nov 11, 2023
35240ec
fix(CreationHeader): state issue with assistant select
danny-avila Nov 11, 2023
866dd7a
refactor: style changes for form, fix setSiblingIdx from useChatHelpe…
danny-avila Nov 11, 2023
2a515fa
feat: parseCompactConvo: begin refactor of slimmer JSON payloads betw…
danny-avila Nov 11, 2023
1955b9a
refactor(endpoints): add assistant endpoint, also use EModelEndpoint …
danny-avila Nov 11, 2023
79efdcb
refactor(useGetConversationsQuery): use object to access query data e…
danny-avila Nov 12, 2023
234d1ff
fix(MultiMessage): react warning of bad state set, making use of effe…
danny-avila Nov 12, 2023
2382099
fix(useNewConvo): use correct atom key (index instead of convoId) for…
danny-avila Nov 12, 2023
b8216f8
refactor: make routing navigation/conversation change simpler
danny-avila Nov 12, 2023
3fe9886
chore: add removeNullishValues for smaller payloads, remove unused fi…
danny-avila Nov 12, 2023
02c18de
WIP: initial complete assistant run handling
danny-avila Nov 12, 2023
6430a1a
fix: CreationPanel form correctly setting internal state
danny-avila Nov 12, 2023
9376fc1
refactor(api/assistants/chat): revise functions to working run handli…
danny-avila Nov 13, 2023
1124ff6
refactor(UI): initial major refactor of ChatForm and options
danny-avila Nov 13, 2023
b85d18c
feat: textarea hook
danny-avila Nov 13, 2023
de7740c
refactor: useAuthRedirect hook and change directory name
danny-avila Nov 13, 2023
5c47286
feat: add ChatRoute (/c/), make optionsBar absolute and change on tex…
danny-avila Nov 13, 2023
0b197c3
feat: match new toggle Nav open button to ChatGPT's
danny-avila Nov 13, 2023
b778527
feat: add OpenAI custom classnames
danny-avila Nov 13, 2023
1db909f
feat: useOriginNavigate
danny-avila Nov 13, 2023
8b56b87
feat: messages loading view
danny-avila Nov 13, 2023
380b8e2
fix: conversation navigation and effects
danny-avila Nov 13, 2023
74792d7
refactor: make toggle change nav opacity
danny-avila Nov 13, 2023
1b56ea2
WIP: new endpoint menu
danny-avila Nov 14, 2023
f413132
feat: NewEndpointsMenu complete
danny-avila Nov 14, 2023
1b537e0
fix: ensure set key dialog shows on endpoint change, and new conversa…
danny-avila Nov 14, 2023
5ddc62a
WIP: textarea styling fix, add temp footer, create basic file handlin…
danny-avila Nov 14, 2023
67cee93
feat: image file handling (UI)
danny-avila Nov 14, 2023
2a4b5e2
feat: PopOver and ModelSelect in Header, remove GenButtons
danny-avila Nov 14, 2023
c4daf29
feat: drop file handling
danny-avila Nov 15, 2023
8e701f4
refactor: bug fixes
danny-avila Nov 15, 2023
2bd0c1b
refactor(useSSE): setStorage within setConversation updates
danny-avila Nov 15, 2023
4feff17
feat: conversationKeysAtom, allConversationsSelector, update convos q…
danny-avila Nov 15, 2023
c6eafb6
feat: add popover select dropdowns to allow options in header while a…
danny-avila Nov 15, 2023
3d347e6
style(pluginsSelect): styling changes
danny-avila Nov 15, 2023
7965bd3
refactor(NewEndpointsMenu): make UI components modular
danny-avila Nov 15, 2023
82ef0ef
feat: Presets complete
danny-avila Nov 15, 2023
b69e46d
fix: preset editing, make by index
danny-avila Nov 15, 2023
77cf8b9
fix: conversations not setting on inital navigation, fix getMessages(…
danny-avila Nov 15, 2023
0aec7da
fix: changing preset no longer resets latestMessage
danny-avila Nov 15, 2023
f06d36c
feat: useOnClickOutside for OptionsPopover and fix bug that causes se…
danny-avila Nov 15, 2023
a449d18
fix: revert /chat/ switchToConvo, also use NewDeleteButton in Convo
danny-avila Nov 16, 2023
7a01c6a
fix: Popover correctly closes on close Popover button using custom co…
danny-avila Nov 16, 2023
7a6b3eb
style: new message and nav styling
danny-avila Nov 16, 2023
7837359
style: hover/sibling buttons and preset menu scrolling
danny-avila Nov 16, 2023
f663e9c
feat: new convo header button
danny-avila Nov 16, 2023
fd0f24e
style(Textarea): minor style changes to textarea buttons
danny-avila Nov 16, 2023
ee11348
feat: stop/continue generating and hide hoverbuttons when submitting
danny-avila Nov 16, 2023
260ff2f
feat: compact AI Provider schemas to make json payloads and db saves …
danny-avila Nov 16, 2023
942de99
style: styling changes for consistency on chat route
danny-avila Nov 16, 2023
fc18c9b
fix: created usePresetIndexOptions to prevent bugs between /c/ and /c…
danny-avila Nov 16, 2023
7666860
chore: make /chat/ route default for now since we still lack full ima…
danny-avila Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ meili_data/
api/node_modules/
client/node_modules/
bower_components/
types/
*.d.ts

# Floobits
.floo
Expand Down
14 changes: 7 additions & 7 deletions api/models/schema/convoSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@ const convoSchema = mongoose.Schema(
user: {
type: String,
index: true,
default: null,
// default: null,
},
messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }],
// google only
examples: [{ type: mongoose.Schema.Types.Mixed }],
agentOptions: {
type: mongoose.Schema.Types.Mixed,
default: null,
// default: null,
},
...conversationPreset,
// for bingAI only
bingConversationId: {
type: String,
default: null,
// default: null,
},
jailbreakConversationId: {
type: String,
default: null,
// default: null,
},
conversationSignature: {
type: String,
default: null,
// default: null,
},
clientId: {
type: String,
default: null,
// default: null,
},
invocationId: {
type: Number,
default: 1,
// default: 1,
},
},
{ timestamps: true },
Expand Down
56 changes: 28 additions & 28 deletions api/models/schema/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,147 +8,147 @@ const conversationPreset = {
// for azureOpenAI, openAI, chatGPTBrowser only
model: {
type: String,
default: null,
// default: null,
required: false,
},
// for azureOpenAI, openAI only
chatGptLabel: {
type: String,
default: null,
// default: null,
required: false,
},
// for google only
modelLabel: {
type: String,
default: null,
// default: null,
required: false,
},
promptPrefix: {
type: String,
default: null,
// default: null,
required: false,
},
temperature: {
type: Number,
default: 1,
// default: 1,
required: false,
},
top_p: {
type: Number,
default: 1,
// default: 1,
required: false,
},
// for google only
topP: {
type: Number,
default: 0.95,
// default: 0.95,
required: false,
},
topK: {
type: Number,
default: 40,
// default: 40,
required: false,
},
maxOutputTokens: {
type: Number,
default: 1024,
// default: 1024,
required: false,
},
presence_penalty: {
type: Number,
default: 0,
// default: 0,
required: false,
},
frequency_penalty: {
type: Number,
default: 0,
// default: 0,
required: false,
},
// for bingai only
jailbreak: {
type: Boolean,
default: false,
// default: false,
},
context: {
type: String,
default: null,
// default: null,
},
systemMessage: {
type: String,
default: null,
// default: null,
},
toneStyle: {
type: String,
default: null,
// default: null,
},
};

const agentOptions = {
model: {
type: String,
default: null,
// default: null,
required: false,
},
// for azureOpenAI, openAI only
chatGptLabel: {
type: String,
default: null,
// default: null,
required: false,
},
// for google only
modelLabel: {
type: String,
default: null,
// default: null,
required: false,
},
promptPrefix: {
type: String,
default: null,
// default: null,
required: false,
},
temperature: {
type: Number,
default: 1,
// default: 1,
required: false,
},
top_p: {
type: Number,
default: 1,
// default: 1,
required: false,
},
// for google only
topP: {
type: Number,
default: 0.95,
// default: 0.95,
required: false,
},
topK: {
type: Number,
default: 40,
// default: 40,
required: false,
},
maxOutputTokens: {
type: Number,
default: 1024,
// default: 1024,
required: false,
},
presence_penalty: {
type: Number,
default: 0,
// default: 0,
required: false,
},
frequency_penalty: {
type: Number,
default: 0,
// default: 0,
required: false,
},
context: {
type: String,
default: null,
// default: null,
},
systemMessage: {
type: String,
default: null,
// default: null,
},
};

Expand Down
13 changes: 12 additions & 1 deletion api/server/controllers/EndpointController.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { EModelEndpoint } = require('../routes/endpoints/schemas');
const { availableTools } = require('../../app/clients/tools');
const { addOpenAPISpecs } = require('../../app/clients/tools/util/addOpenAPISpecs');
const {
Expand All @@ -7,6 +8,7 @@ const {
userProvidedOpenAI,
palmKey,
openAI,
assistant,
azureOpenAI,
bingAI,
chatGPTBrowser,
Expand Down Expand Up @@ -53,7 +55,16 @@ async function endpointController(req, res) {
: false;

res.send(
JSON.stringify({ azureOpenAI, openAI, google, bingAI, chatGPTBrowser, gptPlugins, anthropic }),
JSON.stringify({
[EModelEndpoint.openAI]: openAI,
[EModelEndpoint.assistant]: assistant,
[EModelEndpoint.azureOpenAI]: azureOpenAI,
[EModelEndpoint.google]: google,
[EModelEndpoint.bingAI]: bingAI,
[EModelEndpoint.chatGPTBrowser]: chatGPTBrowser,
[EModelEndpoint.gptPlugins]: gptPlugins,
[EModelEndpoint.anthropic]: anthropic,
}),
);
}

Expand Down
18 changes: 15 additions & 3 deletions api/server/controllers/ModelController.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { EModelEndpoint } = require('../routes/endpoints/schemas');
const {
getOpenAIModels,
getChatGPTBrowserModels,
Expand All @@ -6,17 +7,28 @@ const {

const { useAzurePlugins } = require('../services/EndpointService').config;

const fitlerAssistantModels = (str) => {
return /gpt-4|gpt-3\\.5/i.test(str) && !/vision|instruct/i.test(str);
};

async function modelController(req, res) {
const google = ['chat-bison', 'text-bison', 'codechat-bison'];
const openAI = await getOpenAIModels();
const azureOpenAI = await getOpenAIModels({ azure: true });
const gptPlugins = await getOpenAIModels({ azure: useAzurePlugins, plugins: true });
const bingAI = ['BingAI', 'Sydney'];
const chatGPTBrowser = getChatGPTBrowserModels();
const anthropic = getAnthropicModels();

res.send(
JSON.stringify({ azureOpenAI, openAI, google, bingAI, chatGPTBrowser, gptPlugins, anthropic }),
JSON.stringify({
[EModelEndpoint.openAI]: openAI,
[EModelEndpoint.azureOpenAI]: azureOpenAI,
[EModelEndpoint.assistant]: openAI.filter(fitlerAssistantModels),
[EModelEndpoint.google]: ['chat-bison', 'text-bison', 'codechat-bison'],
[EModelEndpoint.bingAI]: ['BingAI', 'Sydney'],
[EModelEndpoint.chatGPTBrowser]: chatGPTBrowser,
[EModelEndpoint.gptPlugins]: gptPlugins,
[EModelEndpoint.anthropic]: anthropic,
}),
);
}

Expand Down
1 change: 1 addition & 0 deletions api/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const startServer = async () => {
app.use('/api/models', routes.models);
app.use('/api/plugins', routes.plugins);
app.use('/api/config', routes.config);
app.use('/api/assistants', routes.assistants);

// Static files
app.get('/*', function (req, res) {
Expand Down
13 changes: 7 additions & 6 deletions api/server/routes/ask/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {
messageUserLimiter,
} = require('../../middleware');
const { isEnabled } = require('../../utils');
const { EModelEndpoint } = require('../endpoints/schemas');

const { LIMIT_CONCURRENT_MESSAGES, LIMIT_MESSAGE_IP, LIMIT_MESSAGE_USER } = process.env ?? {};

Expand All @@ -34,11 +35,11 @@ if (isEnabled(LIMIT_MESSAGE_USER)) {
router.use(messageUserLimiter);
}

router.use(['/azureOpenAI', '/openAI'], openAI);
router.use('/google', google);
router.use('/bingAI', bingAI);
router.use('/chatGPTBrowser', askChatGPTBrowser);
router.use('/gptPlugins', gptPlugins);
router.use('/anthropic', anthropic);
router.use([`/${EModelEndpoint.azureOpenAI}`, `/${EModelEndpoint.openAI}`], openAI);
router.use(`/${EModelEndpoint.google}`, google);
router.use(`/${EModelEndpoint.bingAI}`, bingAI);
router.use(`/${EModelEndpoint.chatGPTBrowser}`, askChatGPTBrowser);
router.use(`/${EModelEndpoint.gptPlugins}`, gptPlugins);
router.use(`/${EModelEndpoint.anthropic}`, anthropic);

module.exports = router;
Loading