Skip to content

Commit

Permalink
update streaming ui
Browse files Browse the repository at this point in the history
  • Loading branch information
n4ze3m committed Oct 19, 2023
1 parent d1f302e commit 848b9e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
11 changes: 7 additions & 4 deletions app/ui/src/hooks/useMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const useMessage = () => {
isLoading,
setIsLoading,
isProcessing,
setIsProcessing
setIsProcessing,
} = useStoreMessage();

const param = useParams<{ id: string; history_id?: string }>();
Expand Down Expand Up @@ -146,14 +146,17 @@ export const useMessage = () => {
if (type === "chunk") {
const jsonMessage = JSON.parse(message);
if (count === 0) {
newMessage[appendingIndex].message = jsonMessage.message;
setIsProcessing(true);
newMessage[appendingIndex].message = jsonMessage.message + "▋";
setMessages(newMessage);
} else {
newMessage[appendingIndex].message += jsonMessage.message;
newMessage[appendingIndex].message =
newMessage[appendingIndex].message.slice(0, -1) +
jsonMessage.message +
"▋";
setMessages(newMessage);
}
count++;
setIsProcessing(true);
} else if (type === "result") {
const responseData = JSON.parse(message) as BotResponse;
newMessage[appendingIndex].message = responseData.bot.text;
Expand Down
18 changes: 9 additions & 9 deletions server/prisma/migrations/q_15/migration.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ CREATE UNIQUE INDEX "DialoqbaseModels_model_id_key" ON "DialoqbaseModels"("model


INSERT INTO "DialoqbaseModels" ("name", "model_id", "model_type", "model_provider", "stream_available", "local_model", "config") VALUES
('GPT-3.5 Turbo (OpenAI)', 'gpt-3.5-turbo', 'chat', 'OpenAI', true, false, '{}'),
('GPT-3.5 Turbo 16K (OpenAI)', 'gpt-3.5-turbo-16k', 'chat', 'OpenAI', true, false, '{}'),
('GPT-4 (OpenAI)', 'gpt-4', 'chat', 'OpenAI', true, false, '{}'),
('GPT-4 0613 (OpenAI)', 'gpt-4-0613', 'chat', 'OpenAI', true, false, '{}'),
('GPT-3.5 Turbo Instruct (OpenAI)', 'gpt-3.5-turbo-instruct', 'instruct', 'openai-instruct', true, false, '{}'),
('Claude 1 (Anthropic)', 'claude-1', 'chat', 'Anthropic', true, false, '{}'),
('Claude 2 (Anthropic)', 'claude-2', 'chat', 'Anthropic', true, false, '{}'),
('Claude Instant (Anthropic)', 'claude-instant-1', 'chat', 'Anthropic', true, false, '{}'),
('Google chat-bison-001', 'google-bison', 'chat', 'Google', false, false, '{}'),
('GPT-3.5 Turbo (OpenAI)', 'gpt-3.5-turbo-dbase', 'chat', 'OpenAI', true, false, '{}'),
('GPT-3.5 Turbo 16K (OpenAI)', 'gpt-3.5-turbo-16k-dbase', 'chat', 'OpenAI', true, false, '{}'),
('GPT-4 (OpenAI)', 'gpt-4-dbase', 'chat', 'OpenAI', true, false, '{}'),
('GPT-4 0613 (OpenAI)', 'gpt-4-0613-dbase', 'chat', 'OpenAI', true, false, '{}'),
('GPT-3.5 Turbo Instruct (OpenAI)', 'gpt-3.5-turbo-instruct-dbase', 'instruct', 'openai-instruct', true, false, '{}'),
('Claude 1 (Anthropic)', 'claude-1-dbase', 'chat', 'Anthropic', true, false, '{}'),
('Claude 2 (Anthropic)', 'claude-2-dbase', 'chat', 'Anthropic', true, false, '{}'),
('Claude Instant (Anthropic)', 'claude-instant-1-dbase', 'chat', 'Anthropic', true, false, '{}'),
('Google chat-bison-001', 'google-bison-dbase', 'chat', 'Google', false, false, '{}'),
('Llama v2 7B (Fireworks)', 'accounts/fireworks/models/llama-v2-7b-chat', 'chat', 'Fireworks', true, false, '{}'),
('Llama v2 13B (Fireworks)', 'accounts/fireworks/models/llama-v2-13b-chat', 'chat', 'Fireworks', true, false, '{}'),
('Llama v2 70B (Fireworks)', 'accounts/fireworks/models/llama-v2-70b-chat', 'chat', 'Fireworks', true, false, '{}'),
Expand Down
4 changes: 4 additions & 0 deletions server/src/utils/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ export const chatModelProvider = (
temperature: number,
otherFields?: any
) => {
modelName = modelName.replace("-dbase", "");

console.log("provider", provider);
console.log("modelName", modelName);


switch (provider.toLowerCase()) {
case "openai":
console.log("using openai");
Expand Down

0 comments on commit 848b9e3

Please sign in to comment.