Skip to content

Commit 6c7536c

Browse files
committed
Ver 1.4.1: httpx -> requests for proxy issue
1 parent 76e1aed commit 6c7536c

7 files changed

Lines changed: 64 additions & 38 deletions

File tree

build.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@
2828
"--output-filename=fish",
2929
"--include-data-dir=assets=assets",
3030
"--include-data-dir=locales=locales",
31-
"--windows-disable-console",
31+
"--windows-console-mode=disable",
3232
"--enable-plugins=pkg-resources",
3333
"--enable-plugins=pyqt6",
34-
"--nofollow-import-to=numpy,mkl,click",
34+
"--nofollow-import-to=torch.cuda,torgb,torch.nn,torch.optim,\
35+
torch.utils,torch.distributed,torch.compiler,torch.functional,\
36+
torch.jit,torch.linalg,torch.amp,torch.ao,torch.autograd\
37+
torch.xpu,torch.mps,torch.npu,torch.fft,torch.func",
38+
# --follow-import-to=numpy
39+
"--nofollow-import-to=mkl,click,scipy,pandas,matplotlib",
3540
"--include-qt-plugins=sensible,multimedia",
3641
"--show-memory",
3742
"--show-progress",

fish/chat.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ def __init__(
6868
# Add form layout and buttons to the main layout
6969
layout.addLayout(form_layout)
7070
button_layout = QHBoxLayout()
71-
button_layout.addWidget(cancel_button)
71+
7272
button_layout.addWidget(save_button)
73+
button_layout.addWidget(cancel_button)
7374
layout.addLayout(button_layout)
7475

7576
self.setLayout(layout)
@@ -81,6 +82,10 @@ def save_settings(self):
8182

8283
if self.chat_api_url and self.system_prompt: # Ensure both fields are not empty
8384
self.accept()
85+
else:
86+
QMessageBox.warning(
87+
self, "Invalid", "Input non-empty valid API URL and System Prompt"
88+
)
8489

8590

8691
class MessageBubble(QWidget):
@@ -403,10 +408,6 @@ def open_settings(self):
403408
f"Chat API is saved as: \n{self.chat_api_url}\n\n"
404409
+ f"System Prompt is saved as: \n{self.system_prompt}",
405410
)
406-
else:
407-
QMessageBox.warning(
408-
self, "Invalid", "Input non-empty valid API URL and System Prompt"
409-
)
410411

411412
def toggle_voice_mode(self):
412413
self.voice_mode_enabled = not self.voice_mode_enabled

fish/modules/worker.py

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import os
2-
3-
os.environ["no_proxy"] = "localhost, 127.0.0.1, 0.0.0.0"
42
import re
53
import subprocess
64
import time
75
import wave
86
from pathlib import Path
97

10-
import httpx
118
import numpy as np
129
import ormsgpack
1310
import psutil
1411
import pyaudio
12+
import requests
1513
import sounddevice as sd
1614
from PyQt6.QtCore import QMutex, QMutexLocker, QThread, pyqtSignal
1715

@@ -193,32 +191,29 @@ def _process_audio_stream(self):
193191
f = open(self.audio_path, "wb")
194192

195193
self.f = f
196-
with httpx.Client() as client:
197-
with client.stream(
198-
"POST",
199-
self.backend,
200-
content=ormsgpack.packb(
201-
request, option=ormsgpack.OPT_SERIALIZE_PYDANTIC
202-
),
203-
headers={
204-
"authorization": f"Bearer {self.api_key}",
205-
"content-type": "application/msgpack",
206-
},
207-
timeout=None,
208-
) as response:
209-
for chunk in response.iter_bytes(chunk_size=frames_per_buffer):
210-
if first_packet_time is None:
211-
first_packet_time = self.elapsed
212-
self.time_worker.stop()
213-
214-
if self.is_interrupted:
215-
return
216-
217-
if streaming:
218-
stream.write(chunk)
219-
f.writeframesraw(chunk)
220-
else:
221-
f.write(chunk)
194+
response = requests.post(
195+
self.backend,
196+
data=ormsgpack.packb(request, option=ormsgpack.OPT_SERIALIZE_PYDANTIC),
197+
stream=streaming,
198+
headers={
199+
"authorization": f"Bearer {self.api_key}",
200+
"content-type": "application/msgpack",
201+
},
202+
)
203+
204+
for chunk in response.iter_content(chunk_size=frames_per_buffer):
205+
if first_packet_time is None:
206+
first_packet_time = self.elapsed
207+
self.time_worker.stop()
208+
209+
if self.is_interrupted:
210+
return
211+
212+
if streaming:
213+
stream.write(chunk)
214+
f.writeframesraw(chunk)
215+
else:
216+
f.write(chunk)
222217

223218
self.finish()
224219

fish/utils/context.py

Whitespace-only changes.

fish/utils/schema.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from dataclasses import dataclass
2+
from typing import Literal
3+
4+
from pydantic import BaseModel
5+
from pydantic.functional_validators import SkipValidation
6+
7+
8+
class ServeVQPart(BaseModel):
9+
type: Literal["vq"] = "vq"
10+
codes: SkipValidation[list[list[int]]]
11+
12+
13+
class ServeTextPart(BaseModel):
14+
type: Literal["text"] = "text"
15+
text: str
16+
17+
18+
class ServeAudioPart(BaseModel):
19+
type: Literal["audio"] = "audio"
20+
audio: bytes
21+
22+
23+
@dataclass(kw_only=True)
24+
class BasePart:
25+
pass

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def main():
2424
splash.show()
2525
QtWidgets.QApplication.processEvents() # assure display splash
2626
window = MainWindow()
27-
qdarktheme.setup_theme(config.theme)
27+
# qdarktheme.setup_theme(config.theme)
2828
# Make output to demonstrate real-time capture
2929

3030
print("This laziman message is redirected to the console.", file=sys.stderr)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fish-speech-gui"
3-
version = "1.3.1"
3+
version = "1.4.1"
44
description = "fish-speech comfortable GUI"
55
readme = "README.md"
66
requires-python = "<3.12,>=3.10"

0 commit comments

Comments
 (0)