mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-25 09:03:43 +08:00
fix: prompt generator
This commit is contained in:
@ -33,7 +33,9 @@ const ConversationView = () => {
|
||||
const [showHeaderShadow, setShowHeaderShadow] = useState<boolean>(false);
|
||||
const conversationViewRef = useRef<HTMLDivElement>(null);
|
||||
const currentConversation = conversationStore.getConversationById(conversationStore.currentConversationId);
|
||||
const messageList = messageStore.messageList.filter((message) => message.conversationId === currentConversation?.id);
|
||||
const messageList = currentConversation
|
||||
? messageStore.messageList.filter((message) => message.conversationId === currentConversation.id)
|
||||
: [];
|
||||
const lastMessage = last(messageList);
|
||||
|
||||
useEffect(() => {
|
||||
@ -111,7 +113,8 @@ const ConversationView = () => {
|
||||
}
|
||||
|
||||
const messageList = messageStore.getState().messageList.filter((message) => message.conversationId === currentConversation.id);
|
||||
let prompt = "";
|
||||
const promptGenerator = getPromptGeneratorOfAssistant(getAssistantById(currentConversation.assistantId)!);
|
||||
let prompt = promptGenerator();
|
||||
let tokens = 0;
|
||||
|
||||
const message: Message = {
|
||||
@ -138,7 +141,6 @@ const ConversationView = () => {
|
||||
} catch (error: any) {
|
||||
toast.error(error.message);
|
||||
}
|
||||
const promptGenerator = getPromptGeneratorOfAssistant(getAssistantById(currentConversation.assistantId)!);
|
||||
prompt = promptGenerator(schema);
|
||||
}
|
||||
let formatedMessageList = [];
|
||||
|
Reference in New Issue
Block a user