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