mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: Submit Feedback #2088 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -63,6 +63,9 @@ export default {
|
||||
listConversation: `${api_host}/conversation/list`,
|
||||
removeConversation: `${api_host}/conversation/rm`,
|
||||
completeConversation: `${api_host}/conversation/completion`,
|
||||
deleteMessage: `${api_host}/conversation/delete_msg`,
|
||||
thumbup: `${api_host}/conversation/thumbup`,
|
||||
tts: `${api_host}/conversation/tts`,
|
||||
// chat for external
|
||||
createToken: `${api_host}/api/new_token`,
|
||||
listToken: `${api_host}/api/token_list`,
|
||||
|
||||
@ -1,5 +1,25 @@
|
||||
import { EmptyConversationId } from '@/constants/chat';
|
||||
import { EmptyConversationId, MessageType } from '@/constants/chat';
|
||||
import { Message } from '@/interfaces/database/chat';
|
||||
import { IMessage } from '@/pages/chat/interface';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
export const isConversationIdExist = (conversationId: string) => {
|
||||
return conversationId !== EmptyConversationId && conversationId !== '';
|
||||
};
|
||||
|
||||
export const buildMessageUuid = (message: Message | IMessage) => {
|
||||
if ('id' in message && message.id) {
|
||||
return message.role === MessageType.User
|
||||
? `${MessageType.User}_${message.id}`
|
||||
: `${MessageType.Assistant}_${message.id}`;
|
||||
}
|
||||
return uuid();
|
||||
};
|
||||
|
||||
export const getMessagePureId = (id: string) => {
|
||||
const strings = id.split('_');
|
||||
if (strings.length > 0) {
|
||||
return strings.at(-1);
|
||||
}
|
||||
return id;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user