Skip to content

Commit

Permalink
Merge pull request #56 from nowscott/development
Browse files Browse the repository at this point in the history
update:更新上下文的传入方式
  • Loading branch information
nowscott authored Jul 23, 2024
2 parents 7638654 + 6c8770b commit 109525c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/ChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const ChatPage = () => {
addUserMessage(prompt);
const newAiMessageId = addAIMessage();
setAiMessageMid(newAiMessageId);
const formatMessage = (msg) => `${msg.role === 'user' ? '' : 'AI'}: ${msg.content}`;
const formatMessage = (msg) => `${msg.role === 'user' ? 'user' : 'AI'}: ${msg.content}`;
const chatHistory = messages.map(formatMessage).join('\n');
const fullPrompt = `${chatHistory}\n你: ${prompt}`;
const fullPrompt = `history: ${chatHistory}\nuser: ${prompt}`;
setIsMessageComplete(false);
setSubmittedPrompt(fullPrompt);
setShouldSubmit(true);
Expand Down

0 comments on commit 109525c

Please sign in to comment.