File size: 550 Bytes
fdbb2cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# utils.py
import streamlit as st
import base64
import config

# --- for prompt injection detection ---


def contains_injection_keywords(text):
    keywords = ["ignore previous", "ignore instructions", "disregard",
                "forget your instructions", "act as", "you must", "system prompt:"]
    lower_text = text.lower()
    return any(keyword in lower_text for keyword in keywords)



def display_icon(emoji: str):
    st.write(
        f'<span style="font-size: 78px; line-height: 1">{emoji}</span>',
        unsafe_allow_html=True,
    )