mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +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()
|
const { copy, isSupported } = useClipboard()
|
||||||
|
|
||||||
onMounted(async () => {
|
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.
|
// The default JSON workflow has about 3000 characters.
|
||||||
const MAX_JSON_LENGTH = 20000
|
const MAX_JSON_LENGTH = 20000
|
||||||
const workflowJSONString = JSON.stringify(app.graph.serialize())
|
const workflowJSONString = JSON.stringify(app.graph.serialize())
|
||||||
@@ -93,9 +107,12 @@ const generateReport = (systemStats: SystemStats) => {
|
|||||||
${props.error.traceback.join('\n')}
|
${props.error.traceback.join('\n')}
|
||||||
\`\`\`
|
\`\`\`
|
||||||
## System Information
|
## System Information
|
||||||
|
- **ComfyUI Version:** ${systemStats.system.comfyui_version}
|
||||||
|
- **Arguments:** ${systemStats.system.argv.join(' ')}
|
||||||
- **OS:** ${systemStats.system.os}
|
- **OS:** ${systemStats.system.os}
|
||||||
- **Python Version:** ${systemStats.system.python_version}
|
- **Python Version:** ${systemStats.system.python_version}
|
||||||
- **Embedded Python:** ${systemStats.system.embedded_python}
|
- **Embedded Python:** ${systemStats.system.embedded_python}
|
||||||
|
- **PyTorch Version:** ${systemStats.system.pytorch_version}
|
||||||
## Devices
|
## Devices
|
||||||
${systemStats.devices
|
${systemStats.devices
|
||||||
.map(
|
.map(
|
||||||
@@ -109,7 +126,10 @@ ${systemStats.devices
|
|||||||
`
|
`
|
||||||
)
|
)
|
||||||
.join('\n')}
|
.join('\n')}
|
||||||
|
## Logs
|
||||||
|
\`\`\`
|
||||||
|
${logs}
|
||||||
|
\`\`\`
|
||||||
## Attached Workflow
|
## Attached Workflow
|
||||||
Please make sure that workflow does not contain any sensitive information such as API keys or passwords.
|
Please make sure that workflow does not contain any sensitive information such as API keys or passwords.
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
User,
|
User,
|
||||||
Settings
|
Settings
|
||||||
} from '@/types/apiTypes'
|
} from '@/types/apiTypes'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
interface QueuePromptRequestBody {
|
interface QueuePromptRequestBody {
|
||||||
client_id: string
|
client_id: string
|
||||||
@@ -46,6 +47,10 @@ class ComfyApi extends EventTarget {
|
|||||||
this.initialClientId = sessionStorage.getItem('clientId')
|
this.initialClientId = sessionStorage.getItem('clientId')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internalURL(route: string): string {
|
||||||
|
return this.api_base + '/internal' + route
|
||||||
|
}
|
||||||
|
|
||||||
apiURL(route: string): string {
|
apiURL(route: string): string {
|
||||||
return this.api_base + '/api' + route
|
return this.api_base + '/api' + route
|
||||||
}
|
}
|
||||||
@@ -652,6 +657,10 @@ class ComfyApi extends EventTarget {
|
|||||||
}
|
}
|
||||||
return resp.json()
|
return resp.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getLogs(): Promise<string> {
|
||||||
|
return (await axios.get(this.internalURL('/logs'))).data
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const api = new ComfyApi()
|
export const api = new ComfyApi()
|
||||||
|
|||||||
@@ -389,7 +389,10 @@ export const zSystemStats = z.object({
|
|||||||
system: z.object({
|
system: z.object({
|
||||||
os: z.string(),
|
os: z.string(),
|
||||||
python_version: 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(
|
devices: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ export default defineConfig({
|
|||||||
base: '',
|
base: '',
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
|
'/internal': {
|
||||||
|
target: DEV_SERVER_COMFYUI_URL,
|
||||||
|
},
|
||||||
'/api': {
|
'/api': {
|
||||||
target: DEV_SERVER_COMFYUI_URL,
|
target: DEV_SERVER_COMFYUI_URL,
|
||||||
// Return empty array for extensions API as these modules
|
// Return empty array for extensions API as these modules
|
||||||
|
|||||||
Reference in New Issue
Block a user