Merge branch 'main' into graph-storage-batch-query
This commit is contained in:
@@ -1 +1 @@
|
||||
__api_version__ = "0150"
|
||||
__api_version__ = "0151"
|
||||
|
File diff suppressed because one or more lines are too long
2
lightrag/api/webui/index.html
generated
2
lightrag/api/webui/index.html
generated
@@ -8,7 +8,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Lightrag</title>
|
||||
<script type="module" crossorigin src="/webui/assets/index-1fU28mRC.js"></script>
|
||||
<script type="module" crossorigin src="/webui/assets/index-CK7D4HV6.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/webui/assets/index-BJDb04H1.css">
|
||||
</head>
|
||||
<body>
|
||||
|
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { toast } from 'sonner'
|
||||
import { updateEntity, updateRelation, checkEntityNameExists } from '@/api/lightrag'
|
||||
import { updateGraphNode, updateGraphEdge } from '@/utils/graphOperations'
|
||||
import { useGraphStore } from '@/stores/graph'
|
||||
import { PropertyName, EditIcon, PropertyValue } from './PropertyRowComponents'
|
||||
import PropertyEditDialog from './PropertyEditDialog'
|
||||
|
||||
@@ -85,12 +85,22 @@ const EditablePropertyRow = ({
|
||||
}
|
||||
|
||||
await updateEntity(entityId, updatedData, true)
|
||||
await updateGraphNode(nodeId, entityId, name, value)
|
||||
try {
|
||||
await useGraphStore.getState().updateNodeAndSelect(nodeId, entityId, name, value)
|
||||
} catch (error) {
|
||||
console.error('Error updating node in graph:', error)
|
||||
throw new Error('Failed to update node in graph')
|
||||
}
|
||||
toast.success(t('graphPanel.propertiesView.success.entityUpdated'))
|
||||
} else if (entityType === 'edge' && sourceId && targetId && edgeId && dynamicId) {
|
||||
const updatedData = { [name]: value }
|
||||
await updateRelation(sourceId, targetId, updatedData)
|
||||
await updateGraphEdge(edgeId, dynamicId, sourceId, targetId, name, value)
|
||||
try {
|
||||
await useGraphStore.getState().updateEdgeAndSelect(edgeId, dynamicId, sourceId, targetId, name, value)
|
||||
} catch (error) {
|
||||
console.error(`Error updating edge ${sourceId}->${targetId} in graph:`, error)
|
||||
throw new Error('Failed to update edge in graph')
|
||||
}
|
||||
toast.success(t('graphPanel.propertiesView.success.relationUpdated'))
|
||||
}
|
||||
|
||||
|
@@ -1,41 +0,0 @@
|
||||
import { useGraphStore } from '@/stores/graph'
|
||||
|
||||
/**
|
||||
* Update node in the graph visualization
|
||||
* This function is now a wrapper around the store's updateNodeAndSelect method
|
||||
*
|
||||
* @param nodeId - ID of the node to update
|
||||
* @param entityId - ID of the entity
|
||||
* @param propertyName - Name of the property being updated
|
||||
* @param newValue - New value for the property
|
||||
*/
|
||||
export const updateGraphNode = async (nodeId: string, entityId: string, propertyName: string, newValue: string) => {
|
||||
try {
|
||||
// Call the store method that handles both data update and UI state
|
||||
await useGraphStore.getState().updateNodeAndSelect(nodeId, entityId, propertyName, newValue)
|
||||
} catch (error) {
|
||||
console.error('Error updating node in graph:', error)
|
||||
throw new Error('Failed to update node in graph')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update edge in the graph visualization
|
||||
* This function is now a wrapper around the store's updateEdgeAndSelect method
|
||||
*
|
||||
* @param edgeId - ID of the edge
|
||||
* @param dynamicId - Dynamic ID of the edge in sigma graph
|
||||
* @param sourceId - ID of the source node
|
||||
* @param targetId - ID of the target node
|
||||
* @param propertyName - Name of the property being updated
|
||||
* @param newValue - New value for the property
|
||||
*/
|
||||
export const updateGraphEdge = async (edgeId: string, dynamicId: string, sourceId: string, targetId: string, propertyName: string, newValue: string) => {
|
||||
try {
|
||||
// Call the store method that handles both data update and UI state
|
||||
await useGraphStore.getState().updateEdgeAndSelect(edgeId, dynamicId, sourceId, targetId, propertyName, newValue)
|
||||
} catch (error) {
|
||||
console.error(`Error updating edge ${sourceId}->${targetId} in graph:`, error)
|
||||
throw new Error('Failed to update edge in graph')
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user