diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 106418e8..964a3cc3 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -106,6 +106,59 @@ export function MaskConfig(props: { ); } +function ContextPromptItem(props: { + prompt: Message; + update: (prompt: Message) => void; + remove: () => void; +}) { + const [focusingInput, setFocusingInput] = useState(false); + + return ( +
+ {!focusingInput && ( + + )} + setFocusingInput(true)} + onBlur={() => setFocusingInput(false)} + onInput={(e) => + props.update({ + ...props.prompt, + content: e.currentTarget.value as any, + }) + } + /> + {!focusingInput && ( + } + className={chatStyle["context-delete-button"]} + onClick={() => props.remove()} + bordered + /> + )} +
+ ); +} + export function ContextPrompts(props: { context: Message[]; updateContext: (updater: (context: Message[]) => void) => void; @@ -128,42 +181,12 @@ export function ContextPrompts(props: { <>
{context.map((c, i) => ( -
- - - updateContextPrompt(i, { - ...c, - content: e.currentTarget.value as any, - }) - } - /> - } - className={chatStyle["context-delete-button"]} - onClick={() => removeContextPrompt(i)} - bordered - /> -
+ updateContextPrompt(i, prompt)} + remove={() => removeContextPrompt(i)} + /> ))}
diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index 32c2f5c0..fe9319e0 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -1,4 +1,3 @@ -import styles from "./settings.module.scss"; import { ALL_MODELS, ModalConfigValidator, ModelConfig } from "../store"; import Locale from "../locales"; diff --git a/app/components/ui-lib.module.scss b/app/components/ui-lib.module.scss index 465fc0de..ce512dab 100644 --- a/app/components/ui-lib.module.scss +++ b/app/components/ui-lib.module.scss @@ -124,6 +124,18 @@ } } +@media screen and (max-width: 600px) { + .modal-container { + width: 100vw; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + + .modal-content { + max-height: 50vh; + } + } +} + .show { opacity: 1; transition: all ease 0.3s; @@ -191,13 +203,3 @@ resize: none; min-width: 50px; } - -@media only screen and (max-width: 600px) { - .modal-container { - width: 90vw; - - .modal-content { - max-height: 50vh; - } - } -} diff --git a/app/store/chat.ts b/app/store/chat.ts index 5abd8129..0d66580d 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -33,7 +33,7 @@ export function createMessage(override: Partial): Message { }; } -export const ROLES: Message["role"][] = ["system", "user", "assistant"]; +export const ROLES: Message["role"][] = ["user", "system", "assistant"]; export interface ChatStat { tokenCount: number; diff --git a/app/styles/globals.scss b/app/styles/globals.scss index f849516a..1ae908be 100644 --- a/app/styles/globals.scss +++ b/app/styles/globals.scss @@ -248,6 +248,10 @@ div.math { display: flex; align-items: center; justify-content: center; + + @media screen and (max-width: 600px) { + align-items: flex-end; + } } .link {