mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-13 05:42:22 +01:00
43 lines
919 B
Swift
43 lines
919 B
Swift
|
import SwiftUI
|
||
|
|
||
|
struct ContentView: View {
|
||
|
@StateObject var llamaState = LlamaState()
|
||
|
|
||
|
@State private var multiLineText = ""
|
||
|
|
||
|
var body: some View {
|
||
|
VStack {
|
||
|
ScrollView(.vertical) {
|
||
|
Text(llamaState.messageLog)
|
||
|
}
|
||
|
|
||
|
TextEditor(text: $multiLineText)
|
||
|
.frame(height: 200)
|
||
|
.padding()
|
||
|
.border(Color.gray, width: 0.5)
|
||
|
Button(action: {
|
||
|
sendText()
|
||
|
}) {
|
||
|
Text("Send")
|
||
|
.padding()
|
||
|
.background(Color.blue)
|
||
|
.foregroundColor(.white)
|
||
|
.cornerRadius(8)
|
||
|
}
|
||
|
}
|
||
|
.padding()
|
||
|
}
|
||
|
|
||
|
func sendText() {
|
||
|
Task {
|
||
|
await llamaState.complete(text: multiLineText)
|
||
|
multiLineText = ""
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/*
|
||
|
#Preview {
|
||
|
ContentView()
|
||
|
}
|
||
|
*/
|