generated from StanfordSpezi/SpeziTemplateApplication
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
146042a
commit b3a8cda
Showing
7 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// CoachChatView.swift | ||
// MyHeartCounts | ||
// | ||
// Created by Vishnu Ravi on 10/14/24. | ||
// | ||
|
||
import SpeziChat | ||
import SpeziLLM | ||
import SpeziLLMOpenAI | ||
import SwiftUI | ||
|
||
struct CoachChatView: View { | ||
static let schema = LLMOpenAISchema( | ||
parameters: .init( | ||
modelType: .gpt4_o, | ||
systemPrompt: """ | ||
You are a health coach that helps people take care of their cardiovascular health. | ||
""" | ||
) | ||
) | ||
|
||
@LLMSessionProvider(schema: Self.schema) var llm: LLMOpenAISession | ||
@State var showOnboarding = false | ||
@State var muted = true | ||
|
||
var body: some View { | ||
LLMChatView(session: $llm) | ||
.speak(llm.context.chat, muted: muted) | ||
.speechToolbarButton(muted: $muted) | ||
.navigationTitle("Health Coach") | ||
} | ||
} | ||
|
||
#Preview { | ||
CoachChatView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// OpenAIAPIKey.swift | ||
// MyHeartCounts | ||
// | ||
// Created by Vishnu Ravi on 10/14/24. | ||
// | ||
|
||
import SpeziLLM | ||
import SpeziLLMOpenAI | ||
import SpeziOnboarding | ||
import SwiftUI | ||
|
||
|
||
struct OpenAIAPIKey: View { | ||
@Environment(OnboardingNavigationPath.self) private var onboardingNavigationPath | ||
|
||
var body: some View { | ||
LLMOpenAIAPITokenOnboardingStep { | ||
onboardingNavigationPath.nextStep() | ||
} | ||
} | ||
} | ||
#Preview { | ||
OpenAIAPIKey() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters