Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix splicing at the end of the list when the model list changes in the middle of the constant definition,and correcting a error word #4332

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ export function ChatActions(props: {

// if current model is not available
// switch to first available model
const isUnavaliableModel = !models.some((m) => m.name === currentModel);
if (isUnavaliableModel && models.length > 0) {
const isUnavailableModel = !models.some((m) => m.name === currentModel);
if (isUnavailableModel && models.length > 0) {
const nextModel = models[0].name as ModelType;
chatStore.updateCurrentSession(
(session) => (session.mask.modelConfig.model = nextModel),
Expand Down Expand Up @@ -1100,11 +1100,13 @@ function _Chat() {
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handlePaste = useCallback(
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
const currentModel = chatStore.currentSession().mask.modelConfig.model;
if(!isVisionModel(currentModel)){return;}
if (!isVisionModel(currentModel)) {
return;
}
const items = (event.clipboardData || window.clipboardData).items;
for (const item of items) {
if (item.kind === "file" && item.type.startsWith("image/")) {
Expand Down
7 changes: 0 additions & 7 deletions app/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,8 @@ export const useAppConfig = createPersistStore(
if (!newModels || newModels.length === 0) {
return;
}

const oldModels = get().models;
const modelMap: Record<string, LLMModel> = {};

for (const model of oldModels) {
model.available = false;
modelMap[model.name] = model;
}

for (const model of newModels) {
model.available = true;
modelMap[model.name] = model;
Expand Down
Loading