Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shackless committed Apr 22, 2024
2 parents 0b75fe5 + 87d1712 commit 4e77cea
Show file tree
Hide file tree
Showing 15 changed files with 574 additions and 154 deletions.
8 changes: 2 additions & 6 deletions api/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ class SaveSecretCommand(WebSocketCommandModel):
command: Literal["save_secret"] = "save_secret"
secret_name: str
secret_value: str
show_message: bool = True
show_message: Optional[bool] = True


class RecordKeyboardActionsCommand(WebSocketCommandModel):
command: Literal["record_keyboard_actions"] = "record_keyboard_actions"
recording_type: KeyboardRecordingType = KeyboardRecordingType.SINGLE


class RecordMouseActionsCommand(WebSocketCommandModel):
command: Literal["record_mouse_actions"] = "record_mouse_actions"


class StopRecordingCommand(WebSocketCommandModel):
command: Literal["stop_recording"] = "stop_recording"

Expand All @@ -44,7 +40,7 @@ class LogCommand(WebSocketCommandModel):
command: Literal["log"] = "log"
text: str
log_type: LogType
source_name: str = None
source_name: Optional[str] = None
source: LogSource = "system"
tag: Optional[CommandTag] = None

Expand Down
32 changes: 32 additions & 0 deletions api/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,27 @@ class OpenAiModel(Enum):
GPT_4_TURBO_PREVIEW = "gpt-4-turbo-preview"


class MistralModel(Enum):
MISTRAL_7B = "open-mistral-7b"
OPEN_MIXTRAL_8X7B = "open-mixtral-8x7b"
MISTRAL_SMALL = "mistral-small-latest"
MISTRAL_MEDIUM = "mistral-medium-latest"
MISTRAL_LARGE = "mistral-large-latest"


class LlamaModel(Enum):
LLAMA3_8B = "llama3-8b"
LLAMA3_8B_8192 = "llama3-8b-8192"
LLAMA3_70B = "llama3-70b"
LLAMA3_70B_8192 = "llama3-70b-8192"


class WingmanProAzureDeployment(Enum):
GPT_35_TURBO = "gpt-35-turbo"
GPT_4_TURBO = "gpt-4-turbo"
MISTRAL_LARGE = "mistral-large-latest"
LLAMA3_8B = "llama3-8b"
LLAMA3_70B = "llama3-70b"


class OpenAiTtsVoice(Enum):
Expand Down Expand Up @@ -117,12 +135,16 @@ class VoiceActivationSttProvider(Enum):

class ConversationProvider(Enum):
OPENAI = "openai"
MISTRAL = "mistral"
LLAMA = "llama"
AZURE = "azure"
WINGMAN_PRO = "wingman_pro"


class SummarizeProvider(Enum):
OPENAI = "openai"
MISTRAL = "mistral"
LLAMA = "llama"
AZURE = "azure"
WINGMAN_PRO = "wingman_pro"

Expand Down Expand Up @@ -197,6 +219,14 @@ class OpenAiModelEnumModel(BaseEnumModel):
model: OpenAiModel


class MistralModelEnumModel(BaseEnumModel):
model: MistralModel


class LlamaModelEnumModel(BaseEnumModel):
model: LlamaModel


class WingmanProAzureDeploymentEnumModel(BaseEnumModel):
deployment_name: WingmanProAzureDeployment

Expand Down Expand Up @@ -260,6 +290,8 @@ class WingmanProTtsProviderModel(BaseEnumModel):
"ElevenlabsModel": ElevenlabsModelEnumModel,
"TtsVoiceGender": TtsVoiceGenderEnumModel,
"OpenAiModel": OpenAiModelEnumModel,
"MistralModel": MistralModelEnumModel,
"LLamaModel": LlamaModelEnumModel,
"WingmanProAzureDeployment": WingmanProAzureDeploymentEnumModel,
"OpenAiTtsVoice": OpenAiTtsVoiceEnumModel,
"SoundEffect": SoundEffectEnumModel,
Expand Down
26 changes: 24 additions & 2 deletions api/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
AzureApiVersion,
AzureRegion,
ConversationProvider,
LlamaModel,
MistralModel,
TtsVoiceGender,
ElevenlabsModel,
OpenAiModel,
Expand Down Expand Up @@ -101,9 +103,14 @@ class AudioDevice(BaseModel):
# CONFIG MODELS


class AudioDeviceSettings(BaseModel):
hostapi: Optional[int] = 0
name: str


class AudioSettings(BaseModel):
input: Optional[int] = None
output: Optional[int] = None
input: Optional[int | AudioDeviceSettings] = None
output: Optional[int | AudioDeviceSettings] = None


class WhispercppAutostartSettingsConfig(BaseModel):
Expand Down Expand Up @@ -269,6 +276,18 @@ class OpenAiConfig(BaseModel):
"""If you have an organization key, you can set it here."""


class MistralConfig(BaseModel):
conversation_model: MistralModel
summarize_model: MistralModel
endpoint: str


class LlamaConfig(BaseModel):
conversation_model: LlamaModel
summarize_model: LlamaModel
endpoint: str


class WingmanProConfig(BaseModel):
stt_provider: WingmanProSttProvider
tts_provider: WingmanProTtsProvider
Expand Down Expand Up @@ -345,6 +364,7 @@ class CommandKeyboardConfig(BaseModel):
release: Optional[bool] = None
"""Whether to release the key. Optional."""


class CommandMouseConfig(BaseModel):
button: Optional[str] = None
"""The mouse button to press. Optional."""
Expand Down Expand Up @@ -410,6 +430,8 @@ class NestedConfig(BaseModel):
sound: SoundConfig
features: FeaturesConfig
openai: OpenAiConfig
mistral: MistralConfig
llama: LlamaConfig
edge_tts: EdgeTtsConfig
elevenlabs: ElevenlabsConfig
azure: AzureConfig
Expand Down
31 changes: 0 additions & 31 deletions configs/templates/_Star Citizen/Computer.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,34 +412,3 @@ commands:
- Launch Missile
- Fire Missile
# ───────────────────────────────────────────
- name: MoveTurretLeft
actions:
- mouse:
move: [-100, 0]
instant_activation:
- Turret left
# ───────────────────────────────────────────
- name: MoveTurretRight
actions:
- mouse:
move: [100, 0]
instant_activation:
- Turret right
# ───────────────────────────────────────────
- name: MoveTurretUp
actions:
- mouse:
button: left
hold: 1
move: [0, -100]
instant_activation:
- Turret up
# ───────────────────────────────────────────
- name: MoveTurretDown
actions:
- mouse:
button: left
hold: 1
move: [0, 100]
instant_activation:
- Turret down
10 changes: 10 additions & 0 deletions configs/templates/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ openai:
#base_url: https://api.openai.com # or the localhost address of your local LLM etc.
#organization: whatever # If you have an organization key, you can set it here.

mistral:
conversation_model: mistral-large-latest
summarize_model: mistral-medium-latest
endpoint: https://api.mistral.ai/v1

llama:
conversation_model: llama3-70b
summarize_model: llama3-8b
endpoint: https://api.groq.com/openai/v1

# ────────────────────────────────── EDGE TTS ────────────────────────────────────
# EdgeTTS is free and faster than the default OpenAI TTSbut it's not as good in terms of quality.
# Only used if features > tts_provider is set to 'edge_tts' above.
Expand Down
13 changes: 10 additions & 3 deletions providers/open_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
from typing import Literal
from openai import OpenAI, APIStatusError, AzureOpenAI
import azure.cognitiveservices.speech as speechsdk
from api.enums import AzureRegion, LogType, OpenAiModel, OpenAiTtsVoice
from api.enums import (
AzureRegion,
LlamaModel,
LogType,
MistralModel,
OpenAiModel,
OpenAiTtsVoice,
)
from api.interface import (
AzureConfig,
AzureInstanceConfig,
Expand Down Expand Up @@ -69,7 +76,7 @@ def _perform_ask(
self,
client: OpenAI | AzureOpenAI,
messages: list[dict[str, str]],
model: OpenAiModel,
model: OpenAiModel | MistralModel | LlamaModel,
stream: bool,
tools: list[dict[str, any]],
):
Expand Down Expand Up @@ -133,7 +140,7 @@ def transcribe(self, filename: str, model: str = "whisper-1"):
def ask(
self,
messages: list[dict[str, str]],
model: OpenAiModel,
model: OpenAiModel | MistralModel | LlamaModel,
stream: bool = False,
tools: list[dict[str, any]] = None,
):
Expand Down
19 changes: 10 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
azure-cognitiveservices-speech==1.36.0
azure-cognitiveservices-speech==1.37.0
edge-tts==6.1.10
elevenlabslib~=0.21.0
fastapi~=0.110.0
elevenlabslib~=0.22.1
fastapi~=0.110.1
numpy~=1.26.4
openai~=1.14.3
openai~=1.23.2
packaging~=24.0
pedalboard~=0.9.3
platformdirs~=4.2.0
pyaudio~=0.2.14
pydantic~=2.6.4
pydantic~=2.7.0
pydirectinput-rgx==2.1.1
pyinstaller==6.5.0
pyinstaller==6.6.0
python-multipart==0.0.9
PyYAML~=6.0.1
requests~=2.31.0
scipy~=1.12.0
scipy~=1.13.0
sounddevice~=0.4.6
soundfile~=0.12.1
SpeechRecognition~=3.10.1
typing_extensions~=4.10.0
SpeechRecognition~=3.10.3
typing_extensions~=4.11.0
uvicorn~=0.29.0
Loading

0 comments on commit 4e77cea

Please sign in to comment.