File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -871,10 +871,19 @@ export default function App() {
871871 }
872872 } , [ ] ) ;
873873
874+ const generateUUID = useCallback ( ( ) => {
875+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' . replace ( / [ x y ] / g, c => {
876+ const r = Math . random ( ) * 16 | 0 ;
877+ return ( c === 'x' ? r : ( r & 0x3 | 0x8 ) ) . toString ( 16 ) ;
878+ } ) ;
879+ } , [ ] ) ;
880+
874881 const buildAiIframeUrl = useCallback ( async ( questionText ) => {
875882 const encoded = await compressAndEncode ( questionText ) ;
876- return `https://udify.app/chatbot/xg0maoDg7kzrcGT0?sys.query=${ encodeURIComponent ( encoded ) } ` ;
877- } , [ compressAndEncode ] ) ;
883+ const userId = await compressAndEncode ( 'ai-analyzer' ) ;
884+ const conversationId = await compressAndEncode ( generateUUID ( ) ) ;
885+ return `https://udify.app/chatbot/xg0maoDg7kzrcGT0?sys.query=${ encodeURIComponent ( encoded ) } &sys.user_id=${ encodeURIComponent ( userId ) } &sys.conversation_id=${ encodeURIComponent ( conversationId ) } &_t=${ Date . now ( ) } ` ;
886+ } , [ compressAndEncode , generateUUID ] ) ;
878887
879888 const openAiAnalysis = useCallback ( async ( question ) => {
880889 const text = `请帮我解析以下物联网题目:\n\n【题目】${ question . question } \n\n【选项】\n${ question . options . map ( ( o ) => `${ o . id } . ${ o . text } ` ) . join ( '\n' ) } \n\n请给出正确答案并详细解析。` ;
You can’t perform that action at this time.
0 commit comments