|
import { PRESET_PLACEHOLDER } from 'features/stylePresets/hooks/usePresetModifiedPrompts'; |
|
|
|
export const getViewModeChunks = (currentPrompt: string, presetPrompt?: string): [string, string, string] => { |
|
if (!presetPrompt || !presetPrompt.length) { |
|
return ['', currentPrompt, '']; |
|
} |
|
|
|
|
|
if (!presetPrompt.includes(PRESET_PLACEHOLDER)) { |
|
return ['', `${currentPrompt} `, presetPrompt]; |
|
} |
|
|
|
|
|
const [before, ...after] = presetPrompt.split(PRESET_PLACEHOLDER); |
|
|
|
return [before || '', currentPrompt, after.join(PRESET_PLACEHOLDER) || '']; |
|
}; |
|
|