Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Upload index.html with huggingface_hub
Browse files- index.html +570 -19
 
    	
        index.html
    CHANGED
    
    | 
         @@ -1,19 +1,570 @@ 
     | 
|
| 1 | 
         
            -
            <! 
     | 
| 2 | 
         
            -
            <html>
         
     | 
| 3 | 
         
            -
             
     | 
| 4 | 
         
            -
             
     | 
| 5 | 
         
            -
             
     | 
| 6 | 
         
            -
             
     | 
| 7 | 
         
            -
             
     | 
| 8 | 
         
            -
             
     | 
| 9 | 
         
            -
             
     | 
| 10 | 
         
            -
             
     | 
| 11 | 
         
            -
             
     | 
| 12 | 
         
            -
             
     | 
| 13 | 
         
            -
             
     | 
| 14 | 
         
            -
             
     | 
| 15 | 
         
            -
             
     | 
| 16 | 
         
            -
             
     | 
| 17 | 
         
            -
             
     | 
| 18 | 
         
            -
             
     | 
| 19 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            <!DOCTYPE html>
         
     | 
| 2 | 
         
            +
            <html lang="en">
         
     | 
| 3 | 
         
            +
            <head>
         
     | 
| 4 | 
         
            +
                <meta charset="UTF-8">
         
     | 
| 5 | 
         
            +
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         
     | 
| 6 | 
         
            +
                <title>Chat with Research Paper: Context Engineering for LLMs</title>
         
     | 
| 7 | 
         
            +
                <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
         
     | 
| 8 | 
         
            +
                <style>
         
     | 
| 9 | 
         
            +
                    :root {
         
     | 
| 10 | 
         
            +
                        --primary: #4361ee;
         
     | 
| 11 | 
         
            +
                        --secondary: #3f37c9;
         
     | 
| 12 | 
         
            +
                        --accent: #4895ef;
         
     | 
| 13 | 
         
            +
                        --light: #f8f9fa;
         
     | 
| 14 | 
         
            +
                        --dark: #212529;
         
     | 
| 15 | 
         
            +
                        --success: #4cc9f0;
         
     | 
| 16 | 
         
            +
                        --user-bg: #4361ee;
         
     | 
| 17 | 
         
            +
                        --bot-bg: #f0f2f5;
         
     | 
| 18 | 
         
            +
                        --shadow: 0 4px 6px rgba(0,0,0,0.1);
         
     | 
| 19 | 
         
            +
                    }
         
     | 
| 20 | 
         
            +
             
     | 
| 21 | 
         
            +
                    * {
         
     | 
| 22 | 
         
            +
                        margin: 0;
         
     | 
| 23 | 
         
            +
                        padding: 0;
         
     | 
| 24 | 
         
            +
                        box-sizing: border-box;
         
     | 
| 25 | 
         
            +
                        font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
         
     | 
| 26 | 
         
            +
                    }
         
     | 
| 27 | 
         
            +
             
     | 
| 28 | 
         
            +
                    body {
         
     | 
| 29 | 
         
            +
                        background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
         
     | 
| 30 | 
         
            +
                        color: var(--dark);
         
     | 
| 31 | 
         
            +
                        min-height: 100vh;
         
     | 
| 32 | 
         
            +
                        display: flex;
         
     | 
| 33 | 
         
            +
                        flex-direction: column;
         
     | 
| 34 | 
         
            +
                    }
         
     | 
| 35 | 
         
            +
             
     | 
| 36 | 
         
            +
                    .header {
         
     | 
| 37 | 
         
            +
                        background: linear-gradient(to right, var(--primary), var(--secondary));
         
     | 
| 38 | 
         
            +
                        color: white;
         
     | 
| 39 | 
         
            +
                        padding: 1.5rem;
         
     | 
| 40 | 
         
            +
                        text-align: center;
         
     | 
| 41 | 
         
            +
                        box-shadow: var(--shadow);
         
     | 
| 42 | 
         
            +
                        position: relative;
         
     | 
| 43 | 
         
            +
                        z-index: 10;
         
     | 
| 44 | 
         
            +
                    }
         
     | 
| 45 | 
         
            +
             
     | 
| 46 | 
         
            +
                    .header h1 {
         
     | 
| 47 | 
         
            +
                        font-size: 1.5rem;
         
     | 
| 48 | 
         
            +
                        font-weight: 600;
         
     | 
| 49 | 
         
            +
                        margin-bottom: 0.5rem;
         
     | 
| 50 | 
         
            +
                    }
         
     | 
| 51 | 
         
            +
             
     | 
| 52 | 
         
            +
                    .header p {
         
     | 
| 53 | 
         
            +
                        font-size: 0.9rem;
         
     | 
| 54 | 
         
            +
                        opacity: 0.9;
         
     | 
| 55 | 
         
            +
                        max-width: 800px;
         
     | 
| 56 | 
         
            +
                        margin: 0 auto;
         
     | 
| 57 | 
         
            +
                        line-height: 1.5;
         
     | 
| 58 | 
         
            +
                    }
         
     | 
| 59 | 
         
            +
             
     | 
| 60 | 
         
            +
                    .paper-info {
         
     | 
| 61 | 
         
            +
                        display: flex;
         
     | 
| 62 | 
         
            +
                        flex-wrap: wrap;
         
     | 
| 63 | 
         
            +
                        gap: 1rem;
         
     | 
| 64 | 
         
            +
                        justify-content: center;
         
     | 
| 65 | 
         
            +
                        margin-top: 1rem;
         
     | 
| 66 | 
         
            +
                        font-size: 0.85rem;
         
     | 
| 67 | 
         
            +
                    }
         
     | 
| 68 | 
         
            +
             
     | 
| 69 | 
         
            +
                    .info-chip {
         
     | 
| 70 | 
         
            +
                        background: rgba(255, 255, 255, 0.2);
         
     | 
| 71 | 
         
            +
                        padding: 0.4rem 0.8rem;
         
     | 
| 72 | 
         
            +
                        border-radius: 2rem;
         
     | 
| 73 | 
         
            +
                        display: flex;
         
     | 
| 74 | 
         
            +
                        align-items: center;
         
     | 
| 75 | 
         
            +
                        gap: 0.5rem;
         
     | 
| 76 | 
         
            +
                    }
         
     | 
| 77 | 
         
            +
             
     | 
| 78 | 
         
            +
                    .chat-container {
         
     | 
| 79 | 
         
            +
                        flex: 1;
         
     | 
| 80 | 
         
            +
                        display: flex;
         
     | 
| 81 | 
         
            +
                        flex-direction: column;
         
     | 
| 82 | 
         
            +
                        max-width: 900px;
         
     | 
| 83 | 
         
            +
                        width: 100%;
         
     | 
| 84 | 
         
            +
                        margin: 1.5rem auto;
         
     | 
| 85 | 
         
            +
                        background: white;
         
     | 
| 86 | 
         
            +
                        border-radius: 16px;
         
     | 
| 87 | 
         
            +
                        box-shadow: var(--shadow);
         
     | 
| 88 | 
         
            +
                        overflow: hidden;
         
     | 
| 89 | 
         
            +
                        position: relative;
         
     | 
| 90 | 
         
            +
                    }
         
     | 
| 91 | 
         
            +
             
     | 
| 92 | 
         
            +
                    .chat-history {
         
     | 
| 93 | 
         
            +
                        flex: 1;
         
     | 
| 94 | 
         
            +
                        padding: 1.5rem;
         
     | 
| 95 | 
         
            +
                        overflow-y: auto;
         
     | 
| 96 | 
         
            +
                        display: flex;
         
     | 
| 97 | 
         
            +
                        flex-direction: column;
         
     | 
| 98 | 
         
            +
                        gap: 1.25rem;
         
     | 
| 99 | 
         
            +
                        background: #fafbfc;
         
     | 
| 100 | 
         
            +
                    }
         
     | 
| 101 | 
         
            +
             
     | 
| 102 | 
         
            +
                    .message {
         
     | 
| 103 | 
         
            +
                        max-width: 85%;
         
     | 
| 104 | 
         
            +
                        display: flex;
         
     | 
| 105 | 
         
            +
                        gap: 0.75rem;
         
     | 
| 106 | 
         
            +
                        animation: fadeIn 0.3s ease-out;
         
     | 
| 107 | 
         
            +
                    }
         
     | 
| 108 | 
         
            +
             
     | 
| 109 | 
         
            +
                    @keyframes fadeIn {
         
     | 
| 110 | 
         
            +
                        from { opacity: 0; transform: translateY(10px); }
         
     | 
| 111 | 
         
            +
                        to { opacity: 1; transform: translateY(0); }
         
     | 
| 112 | 
         
            +
                    }
         
     | 
| 113 | 
         
            +
             
     | 
| 114 | 
         
            +
                    .user-message {
         
     | 
| 115 | 
         
            +
                        align-self: flex-end;
         
     | 
| 116 | 
         
            +
                    }
         
     | 
| 117 | 
         
            +
             
     | 
| 118 | 
         
            +
                    .bot-message {
         
     | 
| 119 | 
         
            +
                        align-self: flex-start;
         
     | 
| 120 | 
         
            +
                    }
         
     | 
| 121 | 
         
            +
             
     | 
| 122 | 
         
            +
                    .avatar {
         
     | 
| 123 | 
         
            +
                        width: 36px;
         
     | 
| 124 | 
         
            +
                        height: 36px;
         
     | 
| 125 | 
         
            +
                        border-radius: 50%;
         
     | 
| 126 | 
         
            +
                        display: flex;
         
     | 
| 127 | 
         
            +
                        align-items: center;
         
     | 
| 128 | 
         
            +
                        justify-content: center;
         
     | 
| 129 | 
         
            +
                        flex-shrink: 0;
         
     | 
| 130 | 
         
            +
                        font-size: 1rem;
         
     | 
| 131 | 
         
            +
                    }
         
     | 
| 132 | 
         
            +
             
     | 
| 133 | 
         
            +
                    .user-avatar {
         
     | 
| 134 | 
         
            +
                        background: var(--user-bg);
         
     | 
| 135 | 
         
            +
                        color: white;
         
     | 
| 136 | 
         
            +
                    }
         
     | 
| 137 | 
         
            +
             
     | 
| 138 | 
         
            +
                    .bot-avatar {
         
     | 
| 139 | 
         
            +
                        background: var(--accent);
         
     | 
| 140 | 
         
            +
                        color: white;
         
     | 
| 141 | 
         
            +
                    }
         
     | 
| 142 | 
         
            +
             
     | 
| 143 | 
         
            +
                    .message-content {
         
     | 
| 144 | 
         
            +
                        padding: 0.9rem 1.2rem;
         
     | 
| 145 | 
         
            +
                        border-radius: 18px;
         
     | 
| 146 | 
         
            +
                        line-height: 1.5;
         
     | 
| 147 | 
         
            +
                        box-shadow: var(--shadow);
         
     | 
| 148 | 
         
            +
                        position: relative;
         
     | 
| 149 | 
         
            +
                    }
         
     | 
| 150 | 
         
            +
             
     | 
| 151 | 
         
            +
                    .user-message .message-content {
         
     | 
| 152 | 
         
            +
                        background: var(--user-bg);
         
     | 
| 153 | 
         
            +
                        color: white;
         
     | 
| 154 | 
         
            +
                        border-bottom-right-radius: 4px;
         
     | 
| 155 | 
         
            +
                    }
         
     | 
| 156 | 
         
            +
             
     | 
| 157 | 
         
            +
                    .bot-message .message-content {
         
     | 
| 158 | 
         
            +
                        background: var(--bot-bg);
         
     | 
| 159 | 
         
            +
                        color: var(--dark);
         
     | 
| 160 | 
         
            +
                        border-bottom-left-radius: 4px;
         
     | 
| 161 | 
         
            +
                    }
         
     | 
| 162 | 
         
            +
             
     | 
| 163 | 
         
            +
                    .input-area {
         
     | 
| 164 | 
         
            +
                        padding: 1.2rem;
         
     | 
| 165 | 
         
            +
                        background: white;
         
     | 
| 166 | 
         
            +
                        border-top: 1px solid #eaeaea;
         
     | 
| 167 | 
         
            +
                        display: flex;
         
     | 
| 168 | 
         
            +
                        gap: 0.8rem;
         
     | 
| 169 | 
         
            +
                    }
         
     | 
| 170 | 
         
            +
             
     | 
| 171 | 
         
            +
                    .input-container {
         
     | 
| 172 | 
         
            +
                        flex: 1;
         
     | 
| 173 | 
         
            +
                        position: relative;
         
     | 
| 174 | 
         
            +
                        display: flex;
         
     | 
| 175 | 
         
            +
                        align-items: center;
         
     | 
| 176 | 
         
            +
                    }
         
     | 
| 177 | 
         
            +
             
     | 
| 178 | 
         
            +
                    #user-input {
         
     | 
| 179 | 
         
            +
                        width: 100%;
         
     | 
| 180 | 
         
            +
                        padding: 0.9rem 1.2rem;
         
     | 
| 181 | 
         
            +
                        padding-right: 3rem;
         
     | 
| 182 | 
         
            +
                        border: 1px solid #e0e0e0;
         
     | 
| 183 | 
         
            +
                        border-radius: 2rem;
         
     | 
| 184 | 
         
            +
                        font-size: 1rem;
         
     | 
| 185 | 
         
            +
                        outline: none;
         
     | 
| 186 | 
         
            +
                        transition: all 0.3s;
         
     | 
| 187 | 
         
            +
                        background: #f8f9fa;
         
     | 
| 188 | 
         
            +
                    }
         
     | 
| 189 | 
         
            +
             
     | 
| 190 | 
         
            +
                    #user-input:focus {
         
     | 
| 191 | 
         
            +
                        border-color: var(--accent);
         
     | 
| 192 | 
         
            +
                        box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
         
     | 
| 193 | 
         
            +
                    }
         
     | 
| 194 | 
         
            +
             
     | 
| 195 | 
         
            +
                    .input-container i {
         
     | 
| 196 | 
         
            +
                        position: absolute;
         
     | 
| 197 | 
         
            +
                        right: 1.2rem;
         
     | 
| 198 | 
         
            +
                        color: #6c757d;
         
     | 
| 199 | 
         
            +
                        cursor: pointer;
         
     | 
| 200 | 
         
            +
                    }
         
     | 
| 201 | 
         
            +
             
     | 
| 202 | 
         
            +
                    #send-button {
         
     | 
| 203 | 
         
            +
                        background: var(--primary);
         
     | 
| 204 | 
         
            +
                        color: white;
         
     | 
| 205 | 
         
            +
                        border: none;
         
     | 
| 206 | 
         
            +
                        width: 48px;
         
     | 
| 207 | 
         
            +
                        height: 48px;
         
     | 
| 208 | 
         
            +
                        border-radius: 50%;
         
     | 
| 209 | 
         
            +
                        display: flex;
         
     | 
| 210 | 
         
            +
                        align-items: center;
         
     | 
| 211 | 
         
            +
                        justify-content: center;
         
     | 
| 212 | 
         
            +
                        cursor: pointer;
         
     | 
| 213 | 
         
            +
                        transition: all 0.2s;
         
     | 
| 214 | 
         
            +
                        font-size: 1.1rem;
         
     | 
| 215 | 
         
            +
                        box-shadow: 0 4px 6px rgba(67, 97, 238, 0.3);
         
     | 
| 216 | 
         
            +
                    }
         
     | 
| 217 | 
         
            +
             
     | 
| 218 | 
         
            +
                    #send-button:hover {
         
     | 
| 219 | 
         
            +
                        background: var(--secondary);
         
     | 
| 220 | 
         
            +
                        transform: translateY(-2px);
         
     | 
| 221 | 
         
            +
                    }
         
     | 
| 222 | 
         
            +
             
     | 
| 223 | 
         
            +
                    .suggestions {
         
     | 
| 224 | 
         
            +
                        display: flex;
         
     | 
| 225 | 
         
            +
                        flex-wrap: wrap;
         
     | 
| 226 | 
         
            +
                        gap: 0.8rem;
         
     | 
| 227 | 
         
            +
                        padding: 0 1.5rem 1.5rem;
         
     | 
| 228 | 
         
            +
                        background: white;
         
     | 
| 229 | 
         
            +
                        border-top: 1px solid #eaeaea;
         
     | 
| 230 | 
         
            +
                    }
         
     | 
| 231 | 
         
            +
             
     | 
| 232 | 
         
            +
                    .suggestion-chip {
         
     | 
| 233 | 
         
            +
                        background: #edf2ff;
         
     | 
| 234 | 
         
            +
                        color: var(--primary);
         
     | 
| 235 | 
         
            +
                        padding: 0.6rem 1.2rem;
         
     | 
| 236 | 
         
            +
                        border-radius: 2rem;
         
     | 
| 237 | 
         
            +
                        font-size: 0.9rem;
         
     | 
| 238 | 
         
            +
                        cursor: pointer;
         
     | 
| 239 | 
         
            +
                        transition: all 0.2s;
         
     | 
| 240 | 
         
            +
                        border: 1px solid #dbe4ff;
         
     | 
| 241 | 
         
            +
                    }
         
     | 
| 242 | 
         
            +
             
     | 
| 243 | 
         
            +
                    .suggestion-chip:hover {
         
     | 
| 244 | 
         
            +
                        background: #dbe4ff;
         
     | 
| 245 | 
         
            +
                        transform: translateY(-2px);
         
     | 
| 246 | 
         
            +
                    }
         
     | 
| 247 | 
         
            +
             
     | 
| 248 | 
         
            +
                    .typing-indicator {
         
     | 
| 249 | 
         
            +
                        display: flex;
         
     | 
| 250 | 
         
            +
                        gap: 0.4rem;
         
     | 
| 251 | 
         
            +
                        padding: 0.9rem 1.2rem;
         
     | 
| 252 | 
         
            +
                        background: var(--bot-bg);
         
     | 
| 253 | 
         
            +
                        border-radius: 18px;
         
     | 
| 254 | 
         
            +
                        align-self: flex-start;
         
     | 
| 255 | 
         
            +
                        margin-bottom: 1.25rem;
         
     | 
| 256 | 
         
            +
                    }
         
     | 
| 257 | 
         
            +
             
     | 
| 258 | 
         
            +
                    .typing-dot {
         
     | 
| 259 | 
         
            +
                        width: 8px;
         
     | 
| 260 | 
         
            +
                        height: 8px;
         
     | 
| 261 | 
         
            +
                        background: #6c757d;
         
     | 
| 262 | 
         
            +
                        border-radius: 50%;
         
     | 
| 263 | 
         
            +
                        animation: pulse 1.5s infinite ease-in-out;
         
     | 
| 264 | 
         
            +
                    }
         
     | 
| 265 | 
         
            +
             
     | 
| 266 | 
         
            +
                    .typing-dot:nth-child(2) {
         
     | 
| 267 | 
         
            +
                        animation-delay: 0.2s;
         
     | 
| 268 | 
         
            +
                    }
         
     | 
| 269 | 
         
            +
             
     | 
| 270 | 
         
            +
                    .typing-dot:nth-child(3) {
         
     | 
| 271 | 
         
            +
                        animation-delay: 0.4s;
         
     | 
| 272 | 
         
            +
                    }
         
     | 
| 273 | 
         
            +
             
     | 
| 274 | 
         
            +
                    @keyframes pulse {
         
     | 
| 275 | 
         
            +
                        0%, 100% { transform: scale(0.8); opacity: 0.5; }
         
     | 
| 276 | 
         
            +
                        50% { transform: scale(1); opacity: 1; }
         
     | 
| 277 | 
         
            +
                    }
         
     | 
| 278 | 
         
            +
             
     | 
| 279 | 
         
            +
                    .reference {
         
     | 
| 280 | 
         
            +
                        font-size: 0.8rem;
         
     | 
| 281 | 
         
            +
                        color: #6c757d;
         
     | 
| 282 | 
         
            +
                        margin-top: 0.5rem;
         
     | 
| 283 | 
         
            +
                        padding-left: 0.5rem;
         
     | 
| 284 | 
         
            +
                        border-left: 2px solid var(--accent);
         
     | 
| 285 | 
         
            +
                    }
         
     | 
| 286 | 
         
            +
             
     | 
| 287 | 
         
            +
                    @media (max-width: 768px) {
         
     | 
| 288 | 
         
            +
                        .chat-container {
         
     | 
| 289 | 
         
            +
                            margin: 0;
         
     | 
| 290 | 
         
            +
                            border-radius: 0;
         
     | 
| 291 | 
         
            +
                            height: calc(100vh - 160px);
         
     | 
| 292 | 
         
            +
                        }
         
     | 
| 293 | 
         
            +
                        
         
     | 
| 294 | 
         
            +
                        .header {
         
     | 
| 295 | 
         
            +
                            padding: 1rem;
         
     | 
| 296 | 
         
            +
                        }
         
     | 
| 297 | 
         
            +
                        
         
     | 
| 298 | 
         
            +
                        .header h1 {
         
     | 
| 299 | 
         
            +
                            font-size: 1.3rem;
         
     | 
| 300 | 
         
            +
                        }
         
     | 
| 301 | 
         
            +
                        
         
     | 
| 302 | 
         
            +
                        .message {
         
     | 
| 303 | 
         
            +
                            max-width: 90%;
         
     | 
| 304 | 
         
            +
                        }
         
     | 
| 305 | 
         
            +
                        
         
     | 
| 306 | 
         
            +
                        .chat-history {
         
     | 
| 307 | 
         
            +
                            padding: 1rem;
         
     | 
| 308 | 
         
            +
                        }
         
     | 
| 309 | 
         
            +
                        
         
     | 
| 310 | 
         
            +
                        .input-area {
         
     | 
| 311 | 
         
            +
                            padding: 1rem;
         
     | 
| 312 | 
         
            +
                        }
         
     | 
| 313 | 
         
            +
                    }
         
     | 
| 314 | 
         
            +
             
     | 
| 315 | 
         
            +
                    @media (max-width: 480px) {
         
     | 
| 316 | 
         
            +
                        .avatar {
         
     | 
| 317 | 
         
            +
                            width: 32px;
         
     | 
| 318 | 
         
            +
                            height: 32px;
         
     | 
| 319 | 
         
            +
                            font-size: 0.9rem;
         
     | 
| 320 | 
         
            +
                        }
         
     | 
| 321 | 
         
            +
                        
         
     | 
| 322 | 
         
            +
                        .message-content {
         
     | 
| 323 | 
         
            +
                            padding: 0.7rem 1rem;
         
     | 
| 324 | 
         
            +
                            font-size: 0.95rem;
         
     | 
| 325 | 
         
            +
                        }
         
     | 
| 326 | 
         
            +
                        
         
     | 
| 327 | 
         
            +
                        .suggestion-chip {
         
     | 
| 328 | 
         
            +
                            padding: 0.5rem 1rem;
         
     | 
| 329 | 
         
            +
                            font-size: 0.85rem;
         
     | 
| 330 | 
         
            +
                        }
         
     | 
| 331 | 
         
            +
                    }
         
     | 
| 332 | 
         
            +
                </style>
         
     | 
| 333 | 
         
            +
            </head>
         
     | 
| 334 | 
         
            +
            <body>
         
     | 
| 335 | 
         
            +
                <div class="header">
         
     | 
| 336 | 
         
            +
                    <h1>A Survey of Context Engineering for Large Language Models</h1>
         
     | 
| 337 | 
         
            +
                    <p>Chat with this research paper to explore its key concepts, components, and findings</p>
         
     | 
| 338 | 
         
            +
                    <div class="paper-info">
         
     | 
| 339 | 
         
            +
                        <div class="info-chip">
         
     | 
| 340 | 
         
            +
                            <i class="fas fa-user-graduate"></i>
         
     | 
| 341 | 
         
            +
                            <span>15 Researchers | Multiple Institutions</span>
         
     | 
| 342 | 
         
            +
                        </div>
         
     | 
| 343 | 
         
            +
                        <div class="info-chip">
         
     | 
| 344 | 
         
            +
                            <i class="fas fa-calendar-alt"></i>
         
     | 
| 345 | 
         
            +
                            <span>Published: July 17, 2025</span>
         
     | 
| 346 | 
         
            +
                        </div>
         
     | 
| 347 | 
         
            +
                        <div class="info-chip">
         
     | 
| 348 | 
         
            +
                            <i class="fas fa-tags"></i>
         
     | 
| 349 | 
         
            +
                            <span>Context Engineering, LLM, Multi-Agent Systems</span>
         
     | 
| 350 | 
         
            +
                        </div>
         
     | 
| 351 | 
         
            +
                    </div>
         
     | 
| 352 | 
         
            +
                </div>
         
     | 
| 353 | 
         
            +
             
     | 
| 354 | 
         
            +
                <div class="chat-container">
         
     | 
| 355 | 
         
            +
                    <div class="chat-history" id="chat-history">
         
     | 
| 356 | 
         
            +
                        <div class="message bot-message">
         
     | 
| 357 | 
         
            +
                            <div class="avatar bot-avatar">
         
     | 
| 358 | 
         
            +
                                <i class="fas fa-book"></i>
         
     | 
| 359 | 
         
            +
                            </div>
         
     | 
| 360 | 
         
            +
                            <div class="message-content">
         
     | 
| 361 | 
         
            +
                                <p>Hello! I'm a digital version of the research paper "A Survey of Context Engineering for Large Language Models." You can ask me about:</p>
         
     | 
| 362 | 
         
            +
                                <ul style="margin-top: 0.5rem; padding-left: 1.2rem;">
         
     | 
| 363 | 
         
            +
                                    <li>Key concepts of Context Engineering</li>
         
     | 
| 364 | 
         
            +
                                    <li>Foundational components</li>
         
     | 
| 365 | 
         
            +
                                    <li>System implementations</li>
         
     | 
| 366 | 
         
            +
                                    <li>Research findings and limitations</li>
         
     | 
| 367 | 
         
            +
                                    <li>Authors and publication details</li>
         
     | 
| 368 | 
         
            +
                                </ul>
         
     | 
| 369 | 
         
            +
                                <p style="margin-top: 0.5rem;">What would you like to know about this research?</p>
         
     | 
| 370 | 
         
            +
                            </div>
         
     | 
| 371 | 
         
            +
                        </div>
         
     | 
| 372 | 
         
            +
                    </div>
         
     | 
| 373 | 
         
            +
             
     | 
| 374 | 
         
            +
                    <div class="suggestions">
         
     | 
| 375 | 
         
            +
                        <div class="suggestion-chip" data-question="What is Context Engineering?">
         
     | 
| 376 | 
         
            +
                            What is Context Engineering?
         
     | 
| 377 | 
         
            +
                        </div>
         
     | 
| 378 | 
         
            +
                        <div class="suggestion-chip" data-question="What are the foundational components?">
         
     | 
| 379 | 
         
            +
                            Foundational components
         
     | 
| 380 | 
         
            +
                        </div>
         
     | 
| 381 | 
         
            +
                        <div class="suggestion-chip" data-question="Explain RAG systems">
         
     | 
| 382 | 
         
            +
                            Explain RAG systems
         
     | 
| 383 | 
         
            +
                        </div>
         
     | 
| 384 | 
         
            +
                        <div class="suggestion-chip" data-question="What are the research limitations?">
         
     | 
| 385 | 
         
            +
                            Research limitations
         
     | 
| 386 | 
         
            +
                        </div>
         
     | 
| 387 | 
         
            +
                    </div>
         
     | 
| 388 | 
         
            +
             
     | 
| 389 | 
         
            +
                    <div class="input-area">
         
     | 
| 390 | 
         
            +
                        <div class="input-container">
         
     | 
| 391 | 
         
            +
                            <input type="text" id="user-input" placeholder="Ask about the research paper...">
         
     | 
| 392 | 
         
            +
                            <i class="fas fa-microphone"></i>
         
     | 
| 393 | 
         
            +
                        </div>
         
     | 
| 394 | 
         
            +
                        <button id="send-button">
         
     | 
| 395 | 
         
            +
                            <i class="fas fa-paper-plane"></i>
         
     | 
| 396 | 
         
            +
                        </button>
         
     | 
| 397 | 
         
            +
                    </div>
         
     | 
| 398 | 
         
            +
                </div>
         
     | 
| 399 | 
         
            +
             
     | 
| 400 | 
         
            +
                <script>
         
     | 
| 401 | 
         
            +
                    document.addEventListener('DOMContentLoaded', function() {
         
     | 
| 402 | 
         
            +
                        const chatHistory = document.getElementById('chat-history');
         
     | 
| 403 | 
         
            +
                        const userInput = document.getElementById('user-input');
         
     | 
| 404 | 
         
            +
                        const sendButton = document.getElementById('send-button');
         
     | 
| 405 | 
         
            +
                        const suggestionChips = document.querySelectorAll('.suggestion-chip');
         
     | 
| 406 | 
         
            +
                        
         
     | 
| 407 | 
         
            +
                        // Knowledge base about the research paper
         
     | 
| 408 | 
         
            +
                        const knowledgeBase = {
         
     | 
| 409 | 
         
            +
                            "what is context engineering": {
         
     | 
| 410 | 
         
            +
                                answer: "Context Engineering is a formal discipline that transcends simple prompt design to encompass the systematic optimization of information payloads for Large Language Models (LLMs). It focuses on how contextual information provided during inference fundamentally determines LLM performance.",
         
     | 
| 411 | 
         
            +
                                reference: "Abstract, Section 3.1"
         
     | 
| 412 | 
         
            +
                            },
         
     | 
| 413 | 
         
            +
                            "foundational components": {
         
     | 
| 414 | 
         
            +
                                answer: "The foundational components of Context Engineering are:<br><br>1. <strong>Context Retrieval and Generation</strong>: Prompt-based generation and external knowledge acquisition<br>2. <strong>Context Processing</strong>: Long sequence processing, self-refinement, and structured information integration<br>3. <strong>Context Management</strong>: Memory hierarchies, compression, and optimization techniques",
         
     | 
| 415 | 
         
            +
                                reference: "Section 4: Foundational Components"
         
     | 
| 416 | 
         
            +
                            },
         
     | 
| 417 | 
         
            +
                            "system implementations": {
         
     | 
| 418 | 
         
            +
                                answer: "The paper identifies four sophisticated system implementations:<br><br>1. <strong>Retrieval-Augmented Generation (RAG)</strong>: Modular, agentic, and graph-enhanced architectures<br>2. <strong>Memory Systems</strong>: Enable persistent interactions<br>3. <strong>Tool-Integrated Reasoning</strong>: For function calling and environmental interaction<br>4. <strong>Multi-Agent Systems</strong>: Coordinating communication and orchestration",
         
     | 
| 419 | 
         
            +
                                reference: "Section 5: System Implementations"
         
     | 
| 420 | 
         
            +
                            },
         
     | 
| 421 | 
         
            +
                            "research gap": {
         
     | 
| 422 | 
         
            +
                                answer: "The survey reveals a critical research gap: While current models demonstrate remarkable proficiency in <strong>understanding</strong> complex contexts (with context engineering), they show pronounced limitations in <strong>generating</strong> equally sophisticated, long-form outputs. Addressing this asymmetry is a defining priority for future research.",
         
     | 
| 423 | 
         
            +
                                reference: "Abstract, Section 3.2"
         
     | 
| 424 | 
         
            +
                            },
         
     | 
| 425 | 
         
            +
                            "rag systems": {
         
     | 
| 426 | 
         
            +
                                answer: "Retrieval-Augmented Generation (RAG) systems integrate retrieval mechanisms with LLMs to enhance context. The paper identifies three architectural approaches:<br><br>1. <strong>Modular RAG</strong>: Fixed pipeline with separate retrieval and generation components<br>2. <strong>Agentic RAG</strong>: Dynamic systems that can plan and refine retrieval strategies<br>3. <strong>Graph-Enhanced RAG</strong>: Incorporates knowledge graphs for structured context representation",
         
     | 
| 427 | 
         
            +
                                reference: "Section 5.1"
         
     | 
| 428 | 
         
            +
                            },
         
     | 
| 429 | 
         
            +
                            "context processing techniques": {
         
     | 
| 430 | 
         
            +
                                answer: "Key context processing techniques include:<br><br>- <strong>Long Context Processing</strong>: Methods to handle extended sequences beyond standard context windows<br>- <strong>Contextual Self-Refinement</strong>: Models that iteratively improve context understanding<br>- <strong>Multimodal Context Integration</strong>: Combining text with visual, audio, or other sensory data<br>- <strong>Structured Context Representation</strong>: Using knowledge graphs or schemas to organize information",
         
     | 
| 431 | 
         
            +
                                reference: "Section 4.2"
         
     | 
| 432 | 
         
            +
                            },
         
     | 
| 433 | 
         
            +
                            "authors": {
         
     | 
| 434 | 
         
            +
                                answer: "The paper is authored by 15 researchers from multiple institutions:<br><br>- Lingrui Mei, Jiayu Yao, Yuyao Ge, Baolong Bi, Jiazhi Liu, Mingyu Li, Zhong-Zhi Li, Duzhen Zhang, Jiafeng Guo, Shenghua Liu (ICT, Chinese Academy of Sciences)<br>- Yiwei Wang (UC Merced)<br>- Yujun Cai (University of Queensland)<br>- Chenlin Zhou (Peking University)<br>- Jiayi Mao (Tsinghua University)<br>- Tianze Xia (University of Chinese Academy of Sciences)",
         
     | 
| 435 | 
         
            +
                                reference: "Title Page"
         
     | 
| 436 | 
         
            +
                            },
         
     | 
| 437 | 
         
            +
                            "methodology": {
         
     | 
| 438 | 
         
            +
                                answer: "This survey is based on systematic analysis of over 1,400 research papers. It establishes a technical roadmap for Context Engineering through:<br><br>1. Comprehensive taxonomy development<br>2. Component decomposition<br>3. Implementation analysis<br>4. Identification of research gaps<br>5. Development of a unified framework",
         
     | 
| 439 | 
         
            +
                                reference: "Abstract, Section 1"
         
     | 
| 440 | 
         
            +
                            },
         
     | 
| 441 | 
         
            +
                            "contact": {
         
     | 
| 442 | 
         
            +
                                answer: "Corresponding authors:<br><br>- Lingrui Mei: meilingrui23b@ict.ac.cn<br>- Shenghua Liu: liushenghua@ict.ac.cn<br><br>Code Repository: https://github.com/Meirtz/Awesome-Context-Engineering",
         
     | 
| 443 | 
         
            +
                                reference: "Title Page"
         
     | 
| 444 | 
         
            +
                            }
         
     | 
| 445 | 
         
            +
                        };
         
     | 
| 446 | 
         
            +
                        
         
     | 
| 447 | 
         
            +
                        // Add message to chat
         
     | 
| 448 | 
         
            +
                        function addMessage(text, isUser) {
         
     | 
| 449 | 
         
            +
                            const messageDiv = document.createElement('div');
         
     | 
| 450 | 
         
            +
                            messageDiv.className = `message ${isUser ? 'user-message' : 'bot-message'}`;
         
     | 
| 451 | 
         
            +
                            
         
     | 
| 452 | 
         
            +
                            const avatar = document.createElement('div');
         
     | 
| 453 | 
         
            +
                            avatar.className = `avatar ${isUser ? 'user-avatar' : 'bot-avatar'}`;
         
     | 
| 454 | 
         
            +
                            avatar.innerHTML = `<i class="fas ${isUser ? 'fa-user' : 'fa-book'}"></i>`;
         
     | 
| 455 | 
         
            +
                            
         
     | 
| 456 | 
         
            +
                            const content = document.createElement('div');
         
     | 
| 457 | 
         
            +
                            content.className = 'message-content';
         
     | 
| 458 | 
         
            +
                            content.innerHTML = `<p>${text}</p>`;
         
     | 
| 459 | 
         
            +
                            
         
     | 
| 460 | 
         
            +
                            messageDiv.appendChild(avatar);
         
     | 
| 461 | 
         
            +
                            messageDiv.appendChild(content);
         
     | 
| 462 | 
         
            +
                            chatHistory.appendChild(messageDiv);
         
     | 
| 463 | 
         
            +
                            
         
     | 
| 464 | 
         
            +
                            // Scroll to bottom
         
     | 
| 465 | 
         
            +
                            chatHistory.scrollTop = chatHistory.scrollHeight;
         
     | 
| 466 | 
         
            +
                        }
         
     | 
| 467 | 
         
            +
                        
         
     | 
| 468 | 
         
            +
                        // Show typing indicator
         
     | 
| 469 | 
         
            +
                        function showTyping() {
         
     | 
| 470 | 
         
            +
                            const typingDiv = document.createElement('div');
         
     | 
| 471 | 
         
            +
                            typingDiv.className = 'typing-indicator';
         
     | 
| 472 | 
         
            +
                            typingDiv.id = 'typing-indicator';
         
     | 
| 473 | 
         
            +
                            
         
     | 
| 474 | 
         
            +
                            for (let i = 0; i < 3; i++) {
         
     | 
| 475 | 
         
            +
                                const dot = document.createElement('div');
         
     | 
| 476 | 
         
            +
                                dot.className = 'typing-dot';
         
     | 
| 477 | 
         
            +
                                typingDiv.appendChild(dot);
         
     | 
| 478 | 
         
            +
                            }
         
     | 
| 479 | 
         
            +
                            
         
     | 
| 480 | 
         
            +
                            chatHistory.appendChild(typingDiv);
         
     | 
| 481 | 
         
            +
                            chatHistory.scrollTop = chatHistory.scrollHeight;
         
     | 
| 482 | 
         
            +
                            return typingDiv;
         
     | 
| 483 | 
         
            +
                        }
         
     | 
| 484 | 
         
            +
                        
         
     | 
| 485 | 
         
            +
                        // Process user question
         
     | 
| 486 | 
         
            +
                        function processQuestion(question) {
         
     | 
| 487 | 
         
            +
                            // Add user message
         
     | 
| 488 | 
         
            +
                            addMessage(question, true);
         
     | 
| 489 | 
         
            +
                            
         
     | 
| 490 | 
         
            +
                            // Show typing indicator
         
     | 
| 491 | 
         
            +
                            const typingIndicator = showTyping();
         
     | 
| 492 | 
         
            +
                            
         
     | 
| 493 | 
         
            +
                            // Find best match in knowledge base (simple implementation)
         
     | 
| 494 | 
         
            +
                            const cleanQuestion = question.toLowerCase().trim();
         
     | 
| 495 | 
         
            +
                            let response = null;
         
     | 
| 496 | 
         
            +
                            
         
     | 
| 497 | 
         
            +
                            // Check for direct matches first
         
     | 
| 498 | 
         
            +
                            for (const [key, value] of Object.entries(knowledgeBase)) {
         
     | 
| 499 | 
         
            +
                                if (cleanQuestion.includes(key)) {
         
     | 
| 500 | 
         
            +
                                    response = value;
         
     | 
| 501 | 
         
            +
                                    break;
         
     | 
| 502 | 
         
            +
                                }
         
     | 
| 503 | 
         
            +
                            }
         
     | 
| 504 | 
         
            +
                            
         
     | 
| 505 | 
         
            +
                            // If no direct match, try to find similar
         
     | 
| 506 | 
         
            +
                            if (!response) {
         
     | 
| 507 | 
         
            +
                                const keywords = Object.keys(knowledgeBase);
         
     | 
| 508 | 
         
            +
                                for (const keyword of keywords) {
         
     | 
| 509 | 
         
            +
                                    if (cleanQuestion.includes(keyword.split(' ')[0]) || 
         
     | 
| 510 | 
         
            +
                                        cleanQuestion.includes(keyword.split(' ')[1])) {
         
     | 
| 511 | 
         
            +
                                        response = knowledgeBase[keyword];
         
     | 
| 512 | 
         
            +
                                        break;
         
     | 
| 513 | 
         
            +
                                    }
         
     | 
| 514 | 
         
            +
                                }
         
     | 
| 515 | 
         
            +
                            }
         
     | 
| 516 | 
         
            +
                            
         
     | 
| 517 | 
         
            +
                            // Default response if no match found
         
     | 
| 518 | 
         
            +
                            if (!response) {
         
     | 
| 519 | 
         
            +
                                response = {
         
     | 
| 520 | 
         
            +
                                    answer: "I'm sorry, I don't have specific information about that aspect of the paper. " + 
         
     | 
| 521 | 
         
            +
                                            "You might ask about:<br><br>" +
         
     | 
| 522 | 
         
            +
                                            "- What Context Engineering is<br>" +
         
     | 
| 523 | 
         
            +
                                            "- The foundational components<br>" +
         
     | 
| 524 | 
         
            +
                                            "- System implementations like RAG<br>" +
         
     | 
| 525 | 
         
            +
                                            "- Research findings and limitations",
         
     | 
| 526 | 
         
            +
                                    reference: ""
         
     | 
| 527 | 
         
            +
                                };
         
     | 
| 528 | 
         
            +
                            }
         
     | 
| 529 | 
         
            +
                            
         
     | 
| 530 | 
         
            +
                            // Simulate processing delay
         
     | 
| 531 | 
         
            +
                            setTimeout(() => {
         
     | 
| 532 | 
         
            +
                                // Remove typing indicator
         
     | 
| 533 | 
         
            +
                                if (typingIndicator) typingIndicator.remove();
         
     | 
| 534 | 
         
            +
                                
         
     | 
| 535 | 
         
            +
                                // Add bot response
         
     | 
| 536 | 
         
            +
                                let fullResponse = response.answer;
         
     | 
| 537 | 
         
            +
                                if (response.reference) {
         
     | 
| 538 | 
         
            +
                                    fullResponse += `<div class="reference">Reference: ${response.reference}</div>`;
         
     | 
| 539 | 
         
            +
                                }
         
     | 
| 540 | 
         
            +
                                addMessage(fullResponse, false);
         
     | 
| 541 | 
         
            +
                            }, 1500);
         
     | 
| 542 | 
         
            +
                        }
         
     | 
| 543 | 
         
            +
                        
         
     | 
| 544 | 
         
            +
                        // Event listeners
         
     | 
| 545 | 
         
            +
                        sendButton.addEventListener('click', () => {
         
     | 
| 546 | 
         
            +
                            if (userInput.value.trim() !== '') {
         
     | 
| 547 | 
         
            +
                                processQuestion(userInput.value);
         
     | 
| 548 | 
         
            +
                                userInput.value = '';
         
     | 
| 549 | 
         
            +
                            }
         
     | 
| 550 | 
         
            +
                        });
         
     | 
| 551 | 
         
            +
                        
         
     | 
| 552 | 
         
            +
                        userInput.addEventListener('keypress', (e) => {
         
     | 
| 553 | 
         
            +
                            if (e.key === 'Enter' && userInput.value.trim() !== '') {
         
     | 
| 554 | 
         
            +
                                processQuestion(userInput.value);
         
     | 
| 555 | 
         
            +
                                userInput.value = '';
         
     | 
| 556 | 
         
            +
                            }
         
     | 
| 557 | 
         
            +
                        });
         
     | 
| 558 | 
         
            +
                        
         
     | 
| 559 | 
         
            +
                        // Suggestion chips
         
     | 
| 560 | 
         
            +
                        suggestionChips.forEach(chip => {
         
     | 
| 561 | 
         
            +
                            chip.addEventListener('click', () => {
         
     | 
| 562 | 
         
            +
                                const question = chip.getAttribute('data-question');
         
     | 
| 563 | 
         
            +
                                userInput.value = question;
         
     | 
| 564 | 
         
            +
                                processQuestion(question);
         
     | 
| 565 | 
         
            +
                            });
         
     | 
| 566 | 
         
            +
                        });
         
     | 
| 567 | 
         
            +
                    });
         
     | 
| 568 | 
         
            +
                </script>
         
     | 
| 569 | 
         
            +
            </body>
         
     | 
| 570 | 
         
            +
            </html>
         
     |