This commit is contained in:
2026-03-13 16:37:53 +09:00
parent 8013e80a34
commit fcd6b5e800
9 changed files with 727 additions and 206 deletions
+13 -20
View File
@@ -46,9 +46,10 @@ import service.SystemSleepPreventer
import service.TradingDecisionCallback
import ui.DashboardScreen
import ui.SettingsScreen
import ui.TradingDecisionLog
// 화면 상태 정의
enum class AppScreen { Settings, Dashboard }
enum class AppScreen { Settings, Dashboard, TradingDecision }
fun getLlamaBinPath(): String {
@@ -75,26 +76,10 @@ fun getLlamaBinPath(): String {
fun main() = application {
SystemSleepPreventer.start()
LaunchedEffect(Unit) {
// NewsService나 KisTradeService에서 사용하는 client를 전달
// DartCodeManager.updateCorpCodes(HttpClient(CIO) {
// install(ContentNegotiation) {
// json(Json {
// ignoreUnknownKeys = true
// encodeDefaults = true // 기본값이 포함된 요청 바디를 정확히 전송하기 위해 필요
// })
// }
// // [수정] 모든 로그(Headers + Body)를 찍도록 설정
// install(Logging) {
// logger = Logger.DEFAULT
// level = LogLevel.BODY
// }
// })
}
// 앱 실행 시 필요한 바이너리 경로 (실행 파일 위치)
val binPath = getLlamaBinPath()
val windowState = rememberWindowState(
placement = WindowPlacement.Maximized
placement = WindowPlacement.Fullscreen
)
Window(onCloseRequest = ::exitApplication, title = "KIS AI 자동매매", state = windowState) {
var currentScreen by remember { mutableStateOf(AppScreen.Settings) }
@@ -127,6 +112,7 @@ fun main() = application {
MAX_PRICE = it[ConfigTable.max_price],
MIN_PRICE = it[ConfigTable.min_price],
MIN_PURCHASE_SCORE = it[ConfigTable.min_purchase_score],
SELL_PROFIT = it[ConfigTable.sell_profit],
GRADE_5_BUY = it[grade_5_buy],
GRADE_5_PROFIT = it[grade_5_profit],
GRADE_4_BUY = it[grade_4_buy],
@@ -143,6 +129,7 @@ fun main() = application {
}
isLoaded = true
}
if (!isLoaded) {
@@ -158,7 +145,10 @@ fun main() = application {
val config = KisSession.config
AutoTradingManager.isSystemReadyToday = true
AutoTradingManager.isSystemCleanedUpToday = false
// LLM 서버 시작 (설정된 모델 경로 사용)
CoroutineScope(Dispatchers.Default).launch {
AutoTradingManager.startAutoDiscoveryLoop()
}
if (config.modelPath.isNotEmpty()) {
LlamaServerManager.startServer(binPath, config.modelPath,port = 8080)
}
@@ -167,13 +157,16 @@ fun main() = application {
}
// 대시보드로 화면 전환
currentScreen = AppScreen.Dashboard
currentScreen = AppScreen.TradingDecision
}
)
}
AppScreen.Dashboard -> {
DashboardScreen()
}
AppScreen.TradingDecision -> {
TradingDecisionLog()
}
}
}
}