mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Users can chat directly without first creating a conversation. #11768 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
export function useAddChatBox() {
|
||||
export function useAddChatBox(isDebugMode: boolean) {
|
||||
const [ids, setIds] = useState<string[]>([uuid()]);
|
||||
|
||||
const hasSingleChatBox = ids.length === 1;
|
||||
@ -16,6 +16,12 @@ export function useAddChatBox() {
|
||||
setIds((prev) => prev.filter((x) => x !== id));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDebugMode) {
|
||||
setIds((pre) => pre.slice(0, 1));
|
||||
}
|
||||
}, [isDebugMode]);
|
||||
|
||||
return {
|
||||
chatBoxIds: ids,
|
||||
hasSingleChatBox,
|
||||
|
||||
Reference in New Issue
Block a user