mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 10:59:53 +00:00
Add support for extra system stats in error report (#684)
* Add support for extra system stats in error report * Add toast on error
This commit is contained in:
@@ -70,10 +70,24 @@ const toast = useToast()
|
||||
const { copy, isSupported } = useClipboard()
|
||||
|
||||
onMounted(async () => {
|
||||
generateReport(await api.getSystemStats())
|
||||
try {
|
||||
const [systemStats, logs] = await Promise.all([
|
||||
api.getSystemStats(),
|
||||
api.getLogs()
|
||||
])
|
||||
generateReport(systemStats, logs)
|
||||
} catch (error) {
|
||||
console.error('Error fetching system stats or logs:', error)
|
||||
toast.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: 'Failed to fetch system information',
|
||||
life: 5000
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const generateReport = (systemStats: SystemStats) => {
|
||||
const generateReport = (systemStats: SystemStats, logs: string) => {
|
||||
// The default JSON workflow has about 3000 characters.
|
||||
const MAX_JSON_LENGTH = 20000
|
||||
const workflowJSONString = JSON.stringify(app.graph.serialize())
|
||||
@@ -93,9 +107,12 @@ const generateReport = (systemStats: SystemStats) => {
|
||||
${props.error.traceback.join('\n')}
|
||||
\`\`\`
|
||||
## System Information
|
||||
- **ComfyUI Version:** ${systemStats.system.comfyui_version}
|
||||
- **Arguments:** ${systemStats.system.argv.join(' ')}
|
||||
- **OS:** ${systemStats.system.os}
|
||||
- **Python Version:** ${systemStats.system.python_version}
|
||||
- **Embedded Python:** ${systemStats.system.embedded_python}
|
||||
- **PyTorch Version:** ${systemStats.system.pytorch_version}
|
||||
## Devices
|
||||
${systemStats.devices
|
||||
.map(
|
||||
@@ -109,7 +126,10 @@ ${systemStats.devices
|
||||
`
|
||||
)
|
||||
.join('\n')}
|
||||
|
||||
## Logs
|
||||
\`\`\`
|
||||
${logs}
|
||||
\`\`\`
|
||||
## Attached Workflow
|
||||
Please make sure that workflow does not contain any sensitive information such as API keys or passwords.
|
||||
\`\`\`
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
User,
|
||||
Settings
|
||||
} from '@/types/apiTypes'
|
||||
import axios from 'axios'
|
||||
|
||||
interface QueuePromptRequestBody {
|
||||
client_id: string
|
||||
@@ -46,6 +47,10 @@ class ComfyApi extends EventTarget {
|
||||
this.initialClientId = sessionStorage.getItem('clientId')
|
||||
}
|
||||
|
||||
internalURL(route: string): string {
|
||||
return this.api_base + '/internal' + route
|
||||
}
|
||||
|
||||
apiURL(route: string): string {
|
||||
return this.api_base + '/api' + route
|
||||
}
|
||||
@@ -652,6 +657,10 @@ class ComfyApi extends EventTarget {
|
||||
}
|
||||
return resp.json()
|
||||
}
|
||||
|
||||
async getLogs(): Promise<string> {
|
||||
return (await axios.get(this.internalURL('/logs'))).data
|
||||
}
|
||||
}
|
||||
|
||||
export const api = new ComfyApi()
|
||||
|
||||
@@ -389,7 +389,10 @@ export const zSystemStats = z.object({
|
||||
system: z.object({
|
||||
os: z.string(),
|
||||
python_version: z.string(),
|
||||
embedded_python: z.boolean()
|
||||
embedded_python: z.boolean(),
|
||||
comfyui_version: z.string(),
|
||||
pytorch_version: z.string(),
|
||||
argv: z.array(z.string())
|
||||
}),
|
||||
devices: z.array(
|
||||
z.object({
|
||||
|
||||
@@ -91,6 +91,9 @@ export default defineConfig({
|
||||
base: '',
|
||||
server: {
|
||||
proxy: {
|
||||
'/internal': {
|
||||
target: DEV_SERVER_COMFYUI_URL,
|
||||
},
|
||||
'/api': {
|
||||
target: DEV_SERVER_COMFYUI_URL,
|
||||
// Return empty array for extensions API as these modules
|
||||
|
||||
Reference in New Issue
Block a user