Spaces:
Running
on
Zero
Running
on
Zero
Upload llmdolphin.py
Browse files- llmdolphin.py +3 -5
llmdolphin.py
CHANGED
@@ -356,8 +356,8 @@ def select_dolphin_language(lang: str):
|
|
356 |
|
357 |
def get_raw_prompt(msg: str):
|
358 |
import re
|
359 |
-
m = re.findall(r'/GENBEGIN/(
|
360 |
-
return re.sub(r'[*/:_"
|
361 |
|
362 |
|
363 |
@spaces.GPU
|
@@ -438,7 +438,6 @@ def dolphin_respond(
|
|
438 |
def dolphin_parse(
|
439 |
history: list[tuple[str, str]],
|
440 |
):
|
441 |
-
import re
|
442 |
if dolphin_sysprompt_mode == "Chat with LLM" or not history or len(history) < 1: "", gr.update(visible=True), gr.update(visible=True)
|
443 |
try:
|
444 |
msg = history[-1][0]
|
@@ -535,8 +534,7 @@ def dolphin_parse_simple(
|
|
535 |
message: str,
|
536 |
history: list[tuple[str, str]],
|
537 |
):
|
538 |
-
|
539 |
-
#if not is_japanese(message) or not history or len(history) < 1: return message
|
540 |
if dolphin_sysprompt_mode == "Chat with LLM" or not history or len(history) < 1: return message
|
541 |
try:
|
542 |
msg = history[-1][0]
|
|
|
356 |
|
357 |
def get_raw_prompt(msg: str):
|
358 |
import re
|
359 |
+
m = re.findall(r'/GENBEGIN/(.+?)/GENEND/', msg, re.DOTALL)
|
360 |
+
return re.sub(r'[*/:_"#\n]', ' ', ", ".join(m)).lower() if m else ""
|
361 |
|
362 |
|
363 |
@spaces.GPU
|
|
|
438 |
def dolphin_parse(
|
439 |
history: list[tuple[str, str]],
|
440 |
):
|
|
|
441 |
if dolphin_sysprompt_mode == "Chat with LLM" or not history or len(history) < 1: "", gr.update(visible=True), gr.update(visible=True)
|
442 |
try:
|
443 |
msg = history[-1][0]
|
|
|
534 |
message: str,
|
535 |
history: list[tuple[str, str]],
|
536 |
):
|
537 |
+
#if not is_japanese(message): return message
|
|
|
538 |
if dolphin_sysprompt_mode == "Chat with LLM" or not history or len(history) < 1: return message
|
539 |
try:
|
540 |
msg = history[-1][0]
|