Добавлен полноценный Pulse development workflow UI
Этот коммит содержится в:
+146
-68
@@ -11,123 +11,201 @@
|
|||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<h1>DevConsole</h1>
|
<h1>DevConsole</h1>
|
||||||
<span>AI Development Runtime</span>
|
<span>Pulse Development Environment</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<a href="#dashboard">Dashboard</a>
|
<a href="#workspace">Workspace</a>
|
||||||
<a href="#prompts">Prompt Lab</a>
|
<a href="#android">Android Devices</a>
|
||||||
<a href="#settings">AI Settings</a>
|
<a href="#build">Build & Install</a>
|
||||||
<a href="#tests">Connection Tests</a>
|
<a href="#prompts">AI Assistant</a>
|
||||||
|
<a href="#settings">Settings</a>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<main class="content">
|
<main class="content">
|
||||||
<section class="card" id="dashboard">
|
<section class="card" id="workspace">
|
||||||
<h2>System Status</h2>
|
<h2>Pulse Workspace</h2>
|
||||||
<div id="systemStatus">Loading...</div>
|
|
||||||
|
<input type="text" id="repoUrl" placeholder="https://github.com/viktor138irk/Pulse">
|
||||||
|
|
||||||
|
<div class="button-row">
|
||||||
|
<button onclick="analyzeProject()">Analyze Project</button>
|
||||||
|
<button onclick="installDependencies()">Install Dependencies</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<pre id="projectResult"></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="card" id="android">
|
||||||
|
<h2>Android Device Manager</h2>
|
||||||
|
|
||||||
|
<div class="button-row">
|
||||||
|
<button onclick="loadDevices()">Refresh Devices</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="devices"></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="card" id="build">
|
||||||
|
<h2>APK Build & Install</h2>
|
||||||
|
|
||||||
|
<input type="text" id="workspacePath" placeholder="/var/lib/devconsole/projects/viktor138irk-Pulse">
|
||||||
|
|
||||||
|
<div class="button-row">
|
||||||
|
<button onclick="buildApk()">Build APK</button>
|
||||||
|
<button onclick="installApk()">Install APK</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<pre id="buildResult"></pre>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="card" id="prompts">
|
<section class="card" id="prompts">
|
||||||
<h2>Prompt Sandbox</h2>
|
<h2>AI Assistant</h2>
|
||||||
<textarea id="promptInput" placeholder="Напиши промт для теста AI..."></textarea>
|
|
||||||
<button onclick="runPrompt()">Run Prompt</button>
|
<textarea id="promptInput" placeholder="Explain Flutter error or generate code..."></textarea>
|
||||||
|
|
||||||
|
<button onclick="runPrompt()">Run AI Task</button>
|
||||||
|
|
||||||
<pre id="promptResult"></pre>
|
<pre id="promptResult"></pre>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="card" id="settings">
|
<section class="card" id="settings">
|
||||||
<h2>OpenAI Settings</h2>
|
<h2>OpenAI Settings</h2>
|
||||||
|
|
||||||
<input type="password" id="apiKey" placeholder="OpenAI API Key">
|
<input type="password" id="apiKey" placeholder="OpenAI API Key">
|
||||||
<input type="text" id="model" value="gpt-5" placeholder="Model">
|
<input type="text" id="model" value="gpt-5" placeholder="Model">
|
||||||
<button onclick="saveSettings()">Save Settings</button>
|
|
||||||
<div id="settingsResult"></div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="card" id="tests">
|
<button onclick="saveSettings()">Save Settings</button>
|
||||||
<h2>Connection Tests</h2>
|
|
||||||
<button onclick="testConnection()">Test OpenAI Connection</button>
|
<div id="settingsResult"></div>
|
||||||
<pre id="testResult"></pre>
|
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
async function loadStatus() {
|
let selectedDevice = '';
|
||||||
const response = await fetch('/api/system/status');
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
document.getElementById('systemStatus').innerHTML = `
|
async function api(url, options = {}) {
|
||||||
<div class="status-grid">
|
const response = await fetch(url, options);
|
||||||
<div class="status-item">
|
return await response.json();
|
||||||
<span>Project</span>
|
}
|
||||||
<strong>${data.project}</strong>
|
|
||||||
</div>
|
async function analyzeProject() {
|
||||||
<div class="status-item">
|
const repo_url = document.getElementById('repoUrl').value;
|
||||||
<span>Version</span>
|
|
||||||
<strong>${data.version}</strong>
|
document.getElementById('projectResult').innerText = 'Analyzing repository...';
|
||||||
</div>
|
|
||||||
<div class="status-item">
|
const data = await api('/api/projects/analyze', {
|
||||||
<span>OpenAI</span>
|
method: 'POST',
|
||||||
<strong>${data.openai_configured ? 'Configured' : 'Not configured'}</strong>
|
headers: {'Content-Type': 'application/json'},
|
||||||
</div>
|
body: JSON.stringify({ repo_url })
|
||||||
<div class="status-item">
|
});
|
||||||
<span>Model</span>
|
|
||||||
<strong>${data.openai_model}</strong>
|
if (data.analysis?.workspace) {
|
||||||
</div>
|
document.getElementById('workspacePath').value = data.analysis.workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('projectResult').innerText = JSON.stringify(data, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function installDependencies() {
|
||||||
|
const repo_url = document.getElementById('repoUrl').value;
|
||||||
|
|
||||||
|
document.getElementById('projectResult').innerText = 'Installing dependencies...';
|
||||||
|
|
||||||
|
const data = await api('/api/projects/install-dependencies', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({ repo_url })
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('projectResult').innerText = JSON.stringify(data, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadDevices() {
|
||||||
|
const data = await api('/api/android/devices', {
|
||||||
|
method: 'POST'
|
||||||
|
});
|
||||||
|
|
||||||
|
const lines = (data.stdout || '').split('\n');
|
||||||
|
const devices = lines.filter(line => line.includes('device') && !line.includes('List'));
|
||||||
|
|
||||||
|
const html = devices.map(device => {
|
||||||
|
const id = device.split(/\s+/)[0];
|
||||||
|
|
||||||
|
return `
|
||||||
|
<div class="status-item ${selectedDevice === id ? 'active-device' : ''}">
|
||||||
|
<strong>${id}</strong>
|
||||||
|
<button onclick="selectDevice('${id}')">Select</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
document.getElementById('devices').innerHTML = html || '<p>No devices connected</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectDevice(id) {
|
||||||
|
selectedDevice = id;
|
||||||
|
loadDevices();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function buildApk() {
|
||||||
|
const workspace = document.getElementById('workspacePath').value;
|
||||||
|
|
||||||
|
document.getElementById('buildResult').innerText = 'Building APK...';
|
||||||
|
|
||||||
|
const data = await api('/api/android/build', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({ workspace })
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('buildResult').innerText = JSON.stringify(data, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function installApk() {
|
||||||
|
const workspace = document.getElementById('workspacePath').value;
|
||||||
|
|
||||||
|
document.getElementById('buildResult').innerText = 'Installing APK...';
|
||||||
|
|
||||||
|
const data = await api('/api/android/install-latest', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({ workspace, device: selectedDevice })
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('buildResult').innerText = JSON.stringify(data, null, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveSettings() {
|
async function saveSettings() {
|
||||||
const api_key = document.getElementById('apiKey').value;
|
const api_key = document.getElementById('apiKey').value;
|
||||||
const model = document.getElementById('model').value;
|
const model = document.getElementById('model').value;
|
||||||
|
|
||||||
const response = await fetch('/api/settings/openai', {
|
const data = await api('/api/settings/openai', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {'Content-Type': 'application/json'},
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ api_key, model })
|
body: JSON.stringify({ api_key, model })
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
document.getElementById('settingsResult').innerText = data.message || data.detail;
|
document.getElementById('settingsResult').innerText = data.message || data.detail;
|
||||||
|
|
||||||
loadStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runPrompt() {
|
async function runPrompt() {
|
||||||
const prompt = document.getElementById('promptInput').value;
|
const prompt = document.getElementById('promptInput').value;
|
||||||
|
|
||||||
document.getElementById('promptResult').innerText = 'Running...';
|
document.getElementById('promptResult').innerText = 'Running AI task...';
|
||||||
|
|
||||||
const response = await fetch('/api/prompts/test', {
|
const data = await api('/api/prompts/test', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {'Content-Type': 'application/json'},
|
||||||
'Content-Type': 'application/json'
|
body: JSON.stringify({ prompt, task_type: 'coding' })
|
||||||
},
|
|
||||||
body: JSON.stringify({ prompt })
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
document.getElementById('promptResult').innerText = data.answer || data.detail;
|
document.getElementById('promptResult').innerText = data.answer || data.detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function testConnection() {
|
loadDevices();
|
||||||
document.getElementById('testResult').innerText = 'Testing...';
|
|
||||||
|
|
||||||
const response = await fetch('/api/settings/openai/test', {
|
|
||||||
method: 'POST'
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
document.getElementById('testResult').innerText = data.answer || data.detail;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadStatus();
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Ссылка в новой задаче
Block a user