mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-16 12:41:38 +00:00
add mode custom
This commit is contained in:
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { useApp } from '../contexts/AppContext'
|
||||
import { CustomModeManager } from '../database/json/custom-mode/CustomModeManager'
|
||||
import { CustomMode, GroupEntry } from '../database/json/custom-mode/types'
|
||||
|
||||
import { CustomModePrompts } from '../utils/modes'
|
||||
|
||||
type UseCustomModes = {
|
||||
createCustomMode: (
|
||||
@@ -22,6 +22,7 @@ type UseCustomModes = {
|
||||
) => Promise<void>
|
||||
FindCustomModeByName: (name: string) => Promise<CustomMode | undefined>
|
||||
customModeList: CustomMode[]
|
||||
customModePrompts: CustomModePrompts
|
||||
}
|
||||
|
||||
export function useCustomModes(): UseCustomModes {
|
||||
@@ -37,6 +38,16 @@ export function useCustomModes(): UseCustomModes {
|
||||
})
|
||||
}, [customModeManager])
|
||||
|
||||
const customModePrompts = useMemo(() => {
|
||||
return customModeList.reduce((acc, customMode) => {
|
||||
acc[customMode.slug] = {
|
||||
roleDefinition: customMode.roleDefinition,
|
||||
customInstructions: customMode.customInstructions,
|
||||
}
|
||||
return acc
|
||||
}, {} as CustomModePrompts)
|
||||
}, [customModeList])
|
||||
|
||||
useEffect(() => {
|
||||
void fetchCustomModeList()
|
||||
}, [fetchCustomModeList])
|
||||
@@ -91,5 +102,6 @@ export function useCustomModes(): UseCustomModes {
|
||||
updateCustomMode,
|
||||
FindCustomModeByName,
|
||||
customModeList,
|
||||
customModePrompts,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user