Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change system role to user role for o1 model #3

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on: [ pull_request, workflow_dispatch ]

permissions: read-all

jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Xcode
run: |
sudo xcode-select -s "/Applications/Xcode_16.app"
xcodebuild -version
- name: Allow macro
run: |
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: Build
uses: yukiarrr/ios-build-action@v1.12.0
with:
project-path: Chato.xcodeproj
p12-base64: ${{ secrets.CERTIFICATES_P12 }}
certificate-password: ${{secrets.CERTIFICATES_P12_PASSWORD}}
mobileprovision-base64: ${{ secrets.MOBILEPROVISION }}
code-signing-identity: ${{ secrets.CODE_SIGN_IDENTITY }}
team-id: ${{ secrets.TEAM_ID }}
# workspace-path: Unity-iPhone.xcworkspace # optional
7 changes: 4 additions & 3 deletions Chato/Views/MessageList/VM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ extension InputAreaView {

func ask(text: String, useContext: Bool = true) {
var openAI: ChatGPTContext
let timeout: Double = chat.option.model.contains("o1-") ? 120.0 : 15.0
let isO1 = chat.option.model.contains("o1-")
let timeout: Double = isO1 ? 120.0 : 15.0
print("using timeout: \(timeout)")
if pref.gptUseProxy, !pref.gptProxyHost.isEmpty {
openAI = ChatGPTContext(apiKey: pref.gptApiKey, proxyHost: pref.gptProxyHost, timeout: timeout)
Expand All @@ -104,7 +105,7 @@ extension InputAreaView {
}

chat.option.prompt?.messages.sorted().reversed().forEach {
macpaw.insert(.init(role: $0.role == .user ? .user : ($0.role == .assistant ? .assistant : .system), content: $0.content), at: 0)
macpaw.insert(.init(role: $0.role == .assistant ? .assistant : ($0.role == .user || isO1 ? .user : .system), content: $0.content), at: 0)
}

newChatCallback()
Expand Down Expand Up @@ -142,7 +143,7 @@ extension InputAreaView {
}
}

if chat.option.model.contains("o1-") {
if isO1 {
print("using stream: false")
openAI.client.chats(query: query) { res in
DispatchQueue.main.async {
Expand Down