mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-21 23:57:58 +01:00
Update block_requests.py to resolve unexpected type error (500 error) (#5976)
This commit is contained in:
parent
125bb7b03b
commit
57119c1b30
@ -43,19 +43,19 @@ def my_open(*args, **kwargs):
|
||||
with original_open(*args, **kwargs) as f:
|
||||
file_contents = f.read()
|
||||
|
||||
file_contents = file_contents.replace(b'\t\t<script\n\t\t\tsrc="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.9/iframeResizer.contentWindow.min.js"\n\t\t\tasync\n\t\t></script>', b'')
|
||||
file_contents = file_contents.replace(b'cdnjs.cloudflare.com', b'127.0.0.1')
|
||||
file_contents = file_contents.replace('\t\t<script\n\t\t\tsrc="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.9/iframeResizer.contentWindow.min.js"\n\t\t\tasync\n\t\t></script>', '')
|
||||
file_contents = file_contents.replace('cdnjs.cloudflare.com', b'127.0.0.1')
|
||||
file_contents = file_contents.replace(
|
||||
b'</head>',
|
||||
b'\n <script src="file/js/katex/katex.min.js"></script>'
|
||||
b'\n <script src="file/js/katex/auto-render.min.js"></script>'
|
||||
b'\n <script src="file/js/highlightjs/highlight.min.js"></script>'
|
||||
b'\n <script src="file/js/highlightjs/highlightjs-copy.min.js"></script>'
|
||||
b'\n <script>hljs.addPlugin(new CopyButtonPlugin());</script>'
|
||||
b'\n </head>'
|
||||
'</head>',
|
||||
'\n <script src="file/js/katex/katex.min.js"></script>'
|
||||
'\n <script src="file/js/katex/auto-render.min.js"></script>'
|
||||
'\n <script src="file/js/highlightjs/highlight.min.js"></script>'
|
||||
'\n <script src="file/js/highlightjs/highlightjs-copy.min.js"></script>'
|
||||
'\n <script>hljs.addPlugin(new CopyButtonPlugin());</script>'
|
||||
'\n </head>'
|
||||
)
|
||||
|
||||
return io.BytesIO(file_contents)
|
||||
return io.StringIO(file_contents)
|
||||
else:
|
||||
return original_open(*args, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user