fix(pi): add snap node compatibility diagnostics and documentation
- Added detailed error logging to detect snap node compatibility issues - When Pi process exits with code 1, log helpful diagnostic info including node path - Add hint to check for snap node and reinstall via apt/nvm - Create SNAP_NODE_COMPATIBILITY.md with full troubleshooting guide - Document root cause: snap node has file descriptor incompatibility with Bun.spawn stdin pipes - Provide clear installation instructions for NodeSource and nvm alternatives
This commit is contained in:
@@ -30,7 +30,11 @@ export function usePiModels() {
|
||||
queryKey: ['PI_MODELS'],
|
||||
enabled: isAuthenticated,
|
||||
queryFn: async () => {
|
||||
const data = await client.get<{ models: ModelOption[]; providerNames?: Record<string, string>; hostHome?: string }>('/pi/models');
|
||||
const data = await client.get<{
|
||||
models: ModelOption[];
|
||||
providerNames?: Record<string, string>;
|
||||
hostHome?: string;
|
||||
}>('/pi/models');
|
||||
|
||||
if (data.providerNames) {
|
||||
globalProviderNames = data.providerNames;
|
||||
@@ -48,13 +52,14 @@ export function usePiModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
/** Filter models by system-wide access policy. New providers pass through. */
|
||||
/** Filter models by system-wide access policy. Super Admin sees all. New providers pass through. */
|
||||
export function useVisiblePiModels() {
|
||||
const models = usePiModels();
|
||||
const { user } = useAuth();
|
||||
const { policy } = useAccessPolicy();
|
||||
const allowed = policy.allowedModels;
|
||||
|
||||
if (allowed.length === 0) return models;
|
||||
if (user?.role === 'Super Admin' || allowed.length === 0) return models;
|
||||
|
||||
const allowedSet = new Set(allowed);
|
||||
const allowedProviderSet = new Set(allowed.map((key) => key.split(':')[0]));
|
||||
|
||||
Reference in New Issue
Block a user