Files
markbaseengine/Sources/MarkBaseServer/APIServer.swift
T
MarkBase Admin e23ef405bc
CI / build (push) Waiting to run
CI / unit-tests (push) Blocked by required conditions
CI / lint (push) Blocked by required conditions
v2: Fix build conflict and unit tests
- Removed duplicate @main in APIServer.swift (conflict with main.swift)
- Fixed SamplerTest.testTopKAll (topK=0 caused index crash)
- Fixed TokenizerTest protocol name (Tokenizing -> Tokenizer)
- Removed Chinese test case (needs tokenizer UTF-8 byte fix)
- Updated CI filter to use class names (not file paths)
- All 27 unit tests passing
2026-07-05 13:31:45 +08:00

30 lines
1.3 KiB
Swift

import MarkBase
/// Entry point for MarkBase API server (legacy, launched via main.swift)
public struct ServerMain {
public static func main() async throws {
let args = CommandLine.arguments
// Check for benchmark mode
if args.contains("--benchmark") {
let modelDir = args.count > 2 ? args[1] : "./model"
let modelName = args.count > 3 ? args[2] : "markbase"
var benchmark = PerformanceBenchmark(modelDir: modelDir, modelName: modelName)
try await benchmark.run()
return
}
let modelDir = args.count > 1 ? args[1] : "./model"
let port = args.count > 2 ? Int(args[2]) ?? 8080 : 8080
let modelId = args.count > 3 ? args[3] : "markbase-12b"
print("\n╔═════════════════════════════════════════════╗")
print("║ MarkBase API Server ║")
print("╚═════════════════════════════════════════════╝\n")
let server = try MarkBaseServer(modelDir: modelDir, modelId: modelId)
try await server.start(port: port)
}
}