This commit is contained in:
2026-02-19 16:55:59 +09:00
parent 535989b8ae
commit b6689f4e1a
171 changed files with 81 additions and 4 deletions
+23 -1
View File
@@ -49,6 +49,28 @@ import ui.SettingsScreen
// 화면 상태 정의
enum class AppScreen { Settings, Dashboard }
fun getLlamaBinPath(): String {
val os = System.getProperty("os.name").lowercase()
val arch = System.getProperty("os.arch").lowercase()
val basePath = "./src/main/resources/bin"
return when {
// Apple Silicon (M1/M2/M3)
os.contains("mac") && (arch.contains("aarch64") || arch.contains("arm64")) -> {
"$basePath/mac-arm64/llama-server"
}
// Intel Mac (2017)
os.contains("mac") -> {
"$basePath/mac-x64/llama-server"
}
// Windows NUC
os.contains("win") -> {
"$basePath/win-x64/llama-server.exe"
}
else -> "$basePath/llama-server"
}
}
fun main() = application {
SystemSleepPreventer.start()
@@ -69,7 +91,7 @@ fun main() = application {
})
}
// 앱 실행 시 필요한 바이너리 경로 (실행 파일 위치)
val binPath = "./src/main/resources/bin/llama-server"
val binPath = getLlamaBinPath()
val windowState = rememberWindowState(
placement = WindowPlacement.Maximized
)
+21 -3
View File
@@ -22,17 +22,35 @@ object LlamaServerManager {
fun startServer(binPath: String, modelPath: String, port: Int, nGpuLayers: Int = 99) {
// 이미 해당 포트에서 실행 중이거나 모델 경로가 비었으면 무시합니다.
if (processes.containsKey(port) || modelPath.isBlank()) return
val os = System.getProperty("os.name").lowercase()
val arch = System.getProperty("os.arch").lowercase()
val (nGpuLayers, threads) = when {
// M3 맥: 통합 메모리 활용 최적 (99레이어, 성능코어 위주 8스레드)
os.contains("mac") && (arch.contains("arm64") || arch.contains("aarch64")) -> {
99 to 8
}
// 윈도우 NUC: Core Ultra 7은 코어가 많으므로 스레드 상향 (OpenVINO 사용 시 nGpu 조정 가능)
os.contains("win") -> {
// NUC 15 Pro (Core Ultra 7 155H)는 16코어 22스레드이므로 12~14 권장
40 to 12
}
// 인텔 맥 2017: 16GB 램 한계로 인해 CPU 위주 설정 권장
else -> {
0 to 4 // 쿼드코어 모델일 가능성이 높음
}
}
val command = listOf(
binPath,
"-m", modelPath,
"--port", port.toString(),
"-c", if (port == 8081) "512" else "8192", // 임베딩용은 컨텍스트가 짧아도 충분합니다.
"-c", if (port == 8081) "512" else "8192",
"-ngl", nGpuLayers.toString(),
"-t", "8", // M3 Pro의 성능 코어를 고려하여 6~8개 권장
"--embedding" // 임베딩 기능을 활성화합니다.
"-t", threads.toString(),
"--embedding"
)
scope.launch {
try {
val pb = ProcessBuilder(command)