Fix LM Studio response payload format compatibility
This commit is contained in:
@@ -49,15 +49,16 @@ const callLMStudioCompletion = async (
|
||||
headers["Authorization"] = `Bearer ${apiKey}`;
|
||||
}
|
||||
|
||||
const payload: any = {
|
||||
model: modelName || "local-model",
|
||||
messages,
|
||||
temperature: 0.3
|
||||
};
|
||||
|
||||
const response = await fetch(targetUrl, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({
|
||||
model: modelName || "local-model",
|
||||
messages,
|
||||
temperature: 0.3,
|
||||
response_format: { type: "json_object" }
|
||||
})
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -5,24 +5,20 @@ APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PID_FILE="$APP_DIR/.app.pid"
|
||||
LOG_FILE="$APP_DIR/.app.log"
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat "$PID_FILE")
|
||||
if kill -0 "$PID" 2>/dev/null; then
|
||||
echo "AI Job Application server is already running (PID: $PID)."
|
||||
echo "Access it at http://localhost:3000"
|
||||
exit 0
|
||||
else
|
||||
# Clean up stale processes
|
||||
PIDS=$(pgrep -f "tsx server.ts")
|
||||
if [ -n "$PIDS" ]; then
|
||||
kill -9 $PIDS 2>/dev/null
|
||||
fi
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starting AI Job Application server..."
|
||||
cd "$APP_DIR" || exit 1
|
||||
nohup npm run dev > "$LOG_FILE" 2>&1 &
|
||||
nohup npx tsx server.ts > "$LOG_FILE" 2>&1 &
|
||||
SERVER_PID=$!
|
||||
echo "$SERVER_PID" > "$PID_FILE"
|
||||
|
||||
sleep 2
|
||||
sleep 3
|
||||
if kill -0 "$SERVER_PID" 2>/dev/null; then
|
||||
echo "✓ Server successfully started (PID: $SERVER_PID)."
|
||||
echo "✓ App running at: http://localhost:3000"
|
||||
@@ -32,3 +28,4 @@ else
|
||||
rm -f "$PID_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user