From eb27f0b6f2686655434df484a9f567682488f934 Mon Sep 17 00:00:00 2001 From: Hugues Chocart Date: Tue, 21 Jan 2025 17:12:39 +0000 Subject: [PATCH] feat: add perplexity model (#720) --- packages/backend/src/utils/playground.ts | 3 +- .../components/SmartViewer/Message.tsx | 37 ++++++++++++++----- .../components/SmartViewer/index.module.css | 5 +++ .../components/checks/ChecksModal.tsx | 2 +- packages/frontend/components/layout/Empty.tsx | 4 +- .../frontend/components/layout/Sidebar.tsx | 2 +- packages/frontend/pages/join.tsx | 2 +- packages/frontend/pages/prompts/[[...id]].tsx | 10 ++++- packages/frontend/utils/analytics.ts | 4 +- packages/shared/models.ts | 5 +++ 10 files changed, 56 insertions(+), 18 deletions(-) diff --git a/packages/backend/src/utils/playground.ts b/packages/backend/src/utils/playground.ts index 11c5ada5..17b39f7c 100644 --- a/packages/backend/src/utils/playground.ts +++ b/packages/backend/src/utils/playground.ts @@ -109,6 +109,7 @@ export async function handleStream( res = { choices, + citations: part.citations, // perplexity models return an array of citations links usage: { completion_tokens: tokens, }, @@ -421,7 +422,7 @@ export async function runAImodel( let res = await openai.chat.completions.create({ model, messages, - stream: stream, + stream, temperature: extra?.temperature, max_tokens: extra?.max_tokens, top_p: extra?.top_p, diff --git a/packages/frontend/components/SmartViewer/Message.tsx b/packages/frontend/components/SmartViewer/Message.tsx index 0148aefc..18c05205 100644 --- a/packages/frontend/components/SmartViewer/Message.tsx +++ b/packages/frontend/components/SmartViewer/Message.tsx @@ -224,10 +224,10 @@ function TextMessage({ }) { const text = data.content || data.text; - return ( - - - {editable ? ( + if (editable) { + return ( + +