Fix `custom_generate_chat_prompt`
diff --git a/modules/extensions.py b/modules/extensions.py
index 4762901227..62a21dfba8 100644
--- a/modules/extensions.py
+++ b/modules/extensions.py
@@ -75,10 +75,9 @@ def _apply_input_hijack(text, visible_text):
 
 # custom_generate_chat_prompt handling - currently only the first one will work
 def _apply_custom_generate_chat_prompt(text, state, **kwargs):
-    custom_generate_chat_prompt = None
     for extension, _ in iterator():
         if hasattr(extension, 'custom_generate_chat_prompt'):
-            return custom_generate_chat_prompt(text, state, **kwargs)
+            return extension.custom_generate_chat_prompt(text, state, **kwargs)
 
     return None
 

Fix to allow `custom_generate_chat_prompt` to be loaded from extensions again rather than throwing a TypeError.