This commit is contained in:
lunaticbum 2026-02-19 16:55:59 +09:00
parent 535989b8ae
commit b6689f4e1a
171 changed files with 81 additions and 4 deletions

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
)

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)

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023-2026 The ggml authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
libggml-base.0.dylib

View File

@ -0,0 +1 @@
libggml-base.0.9.7.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libggml-base.0.9.7.dylib

View File

@ -0,0 +1 @@
libggml-base.0.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libggml-blas.0.9.7.dylib

View File

@ -0,0 +1 @@
libggml-blas.0.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libggml-cpu.0.9.7.dylib

View File

@ -0,0 +1 @@
libggml-cpu.0.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libggml-rpc.0.9.7.dylib

View File

@ -0,0 +1 @@
libggml-rpc.0.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libggml.0.9.7.dylib

View File

@ -0,0 +1 @@
libggml.0.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libllama.0.0.8095.dylib

View File

@ -0,0 +1 @@
libllama.0.dylib

Binary file not shown.

View File

@ -0,0 +1 @@
libmtmd.0.0.8095.dylib

View File

@ -0,0 +1 @@
libmtmd.0.dylib

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More