Browse Source

Fix: position of log modal (#5538)

tags/0.6.12
KVOJJJin 1 year ago
parent
commit
41ceb6a4eb
No account linked to committer's email address

+ 1
- 0
web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx View File

showPromptLog showPromptLog
questionIcon={<Avatar name={userProfile.name} size={40} />} questionIcon={<Avatar name={userProfile.name} size={40} />}
allToolIcons={allToolIcons} allToolIcons={allToolIcons}
hideLogModal
/> />
) )
} }

+ 26
- 2
web/app/components/app/configuration/debug/index.tsx View File

import type { ModelParameterModalProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import type { ModelParameterModalProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
import { useEventEmitterContextContext } from '@/context/event-emitter' import { useEventEmitterContextContext } from '@/context/event-emitter'
import { useProviderContext } from '@/context/provider-context' import { useProviderContext } from '@/context/provider-context'
import AgentLogModal from '@/app/components/base/agent-log-modal'
import PromptLogModal from '@/app/components/base/prompt-log-modal' import PromptLogModal from '@/app/components/base/prompt-log-modal'
import { useStore as useAppStore } from '@/app/components/app/store' import { useStore as useAppStore } from '@/app/components/app/store'


handleVisionConfigInMultipleModel() handleVisionConfigInMultipleModel()
}, [multipleModelConfigs, mode]) }, [multipleModelConfigs, mode])


const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal } = useAppStore(useShallow(state => ({
const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal, showAgentLogModal, setShowAgentLogModal } = useAppStore(useShallow(state => ({
currentLogItem: state.currentLogItem, currentLogItem: state.currentLogItem,
setCurrentLogItem: state.setCurrentLogItem, setCurrentLogItem: state.setCurrentLogItem,
showPromptLogModal: state.showPromptLogModal, showPromptLogModal: state.showPromptLogModal,
setShowPromptLogModal: state.setShowPromptLogModal, setShowPromptLogModal: state.setShowPromptLogModal,
showAgentLogModal: state.showAgentLogModal,
setShowAgentLogModal: state.setShowAgentLogModal,
}))) })))
const [width, setWidth] = useState(0) const [width, setWidth] = useState(0)
const ref = useRef<HTMLDivElement>(null) const ref = useRef<HTMLDivElement>(null)
</div> </div>
{ {
debugWithMultipleModel && ( debugWithMultipleModel && (
<div className='grow mt-3 overflow-hidden'>
<div className='grow mt-3 overflow-hidden' ref={ref}>
<DebugWithMultipleModel <DebugWithMultipleModel
multipleModelConfigs={multipleModelConfigs} multipleModelConfigs={multipleModelConfigs}
onMultipleModelConfigsChange={onMultipleModelConfigsChange} onMultipleModelConfigsChange={onMultipleModelConfigsChange}
onDebugWithMultipleModelChange={handleChangeToSingleModel} onDebugWithMultipleModelChange={handleChangeToSingleModel}
checkCanSend={checkCanSend} checkCanSend={checkCanSend}
/> />
{showPromptLogModal && (
<PromptLogModal
width={width}
currentLogItem={currentLogItem}
onCancel={() => {
setCurrentLogItem()
setShowPromptLogModal(false)
}}
/>
)}
{showAgentLogModal && (
<AgentLogModal
width={width}
currentLogItem={currentLogItem}
onCancel={() => {
setCurrentLogItem()
setShowAgentLogModal(false)
}}
/>
)}
</div> </div>
) )
} }
supportAnnotation supportAnnotation
appId={appId} appId={appId}
varList={varList} varList={varList}
siteInfo={null}
/> />
)} )}
</div> </div>

+ 4
- 2
web/app/components/base/chat/chat/index.tsx View File

onFeedback?: (messageId: string, feedback: Feedback) => void onFeedback?: (messageId: string, feedback: Feedback) => void
chatAnswerContainerInner?: string chatAnswerContainerInner?: string
hideProcessDetail?: boolean hideProcessDetail?: boolean
hideLogModal?: boolean
} }
const Chat: FC<ChatProps> = ({ const Chat: FC<ChatProps> = ({
appData, appData,
onFeedback, onFeedback,
chatAnswerContainerInner, chatAnswerContainerInner,
hideProcessDetail, hideProcessDetail,
hideLogModal,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal, showAgentLogModal, setShowAgentLogModal } = useAppStore(useShallow(state => ({ const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal, showAgentLogModal, setShowAgentLogModal } = useAppStore(useShallow(state => ({
} }
</div> </div>
</div> </div>
{showPromptLogModal && (
{showPromptLogModal && !hideLogModal && (
<PromptLogModal <PromptLogModal
width={width} width={width}
currentLogItem={currentLogItem} currentLogItem={currentLogItem}
}} }}
/> />
)} )}
{showAgentLogModal && (
{showAgentLogModal && !hideLogModal && (
<AgentLogModal <AgentLogModal
width={width} width={width}
currentLogItem={currentLogItem} currentLogItem={currentLogItem}

+ 1
- 1
web/app/components/base/prompt-log-modal/index.tsx View File



return ( return (
<div <div
className='fixed top-16 left-2 bottom-2 flex flex-col bg-white border-[0.5px] border-gray-200 rounded-xl shadow-xl z-10'
className='relative flex flex-col bg-white border-[0.5px] border-gray-200 rounded-xl shadow-xl z-10'
style={{ style={{
width: 480, width: 480,
position: 'fixed', position: 'fixed',

Loading…
Cancel
Save