Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5fb99bd

Browse files
committed
chore: address PR comments
1 parent1f0c4df commit5fb99bd

File tree

3 files changed

+29
-49
lines changed

3 files changed

+29
-49
lines changed

‎site/src/contexts/useAgenticChat.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import{experiments}from"api/queries/experiments";
22

33
import{useEmbeddedMetadata}from"hooks/useEmbeddedMetadata";
4-
import{useEffect,useState}from"react";
54
import{useQuery}from"react-query";
65

76
interfaceAgenticChat{
@@ -11,13 +10,7 @@ interface AgenticChat {
1110
exportconstuseAgenticChat=():AgenticChat=>{
1211
const{ metadata}=useEmbeddedMetadata();
1312
constenabledExperimentsQuery=useQuery(experiments(metadata.experiments));
14-
15-
const[enabled,setEnabled]=useState<boolean>(false);
16-
useEffect(()=>{
17-
if(enabledExperimentsQuery.data?.includes("agentic-chat")){
18-
setEnabled(true);
19-
}
20-
});
21-
22-
return{ enabled};
13+
return{
14+
enabled:enabledExperimentsQuery.data?.includes("agentic-chat")??false,
15+
};
2316
};

‎site/src/pages/ChatPage/ChatLanding.tsx

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,6 @@ const ChatLanding: FC = () => {
2727
constqueryClient=useQueryClient();
2828
constcreateChatMutation=useMutation(createChat(queryClient));
2929

30-
consthandleInputChange=(event:React.ChangeEvent<HTMLInputElement>)=>{
31-
setInput(event.target.value);
32-
};
33-
34-
// Placeholder submit handler
35-
consthandleFormSubmit=(e:FormEvent<HTMLFormElement>)=>{
36-
e.preventDefault();
37-
if(!input.trim())return;
38-
// Actual submission logic will go elsewhere
39-
setInput("");// Clear input after submit (optional)
40-
41-
createChatMutation.mutateAsync().then((chat)=>{
42-
navigate(`/chat/${chat.id}`,{
43-
state:{
44-
chat,
45-
message:input,
46-
},
47-
});
48-
});
49-
};
50-
51-
// Placeholder suggestion handler
52-
consthandleSuggestionClick=(suggestion:string)=>{
53-
setInput(suggestion);
54-
// Optionally trigger focus on the input field here
55-
};
56-
5730
return(
5831
<Margins>
5932
<div
@@ -117,33 +90,37 @@ const ChatLanding: FC = () => {
11790
>
11891
<Button
11992
variant="outlined"
120-
onClick={()=>
121-
handleSuggestionClick("Help me work on issue #...")
122-
}
93+
onClick={()=>setInput("Help me work on issue #...")}
12394
>
12495
Work on Issue
12596
</Button>
12697
<Button
12798
variant="outlined"
128-
onClick={()=>
129-
handleSuggestionClick("Help me build a template for...")
130-
}
99+
onClick={()=>setInput("Help me build a template for...")}
131100
>
132101
Build a Template
133102
</Button>
134103
<Button
135104
variant="outlined"
136-
onClick={()=>
137-
handleSuggestionClick("Help me start a new project using...")
138-
}
105+
onClick={()=>setInput("Help me start a new project using...")}
139106
>
140107
Start a Project
141108
</Button>
142109
</Stack>
143110
<LanguageModelSelector/>
144111
<Paper
145112
component="form"
146-
onSubmit={handleFormSubmit}
113+
onSubmit={async(e:FormEvent<HTMLFormElement>)=>{
114+
e.preventDefault();
115+
setInput("");
116+
constchat=awaitcreateChatMutation.mutateAsync();
117+
navigate(`/chat/${chat.id}`,{
118+
state:{
119+
chat,
120+
message:input,
121+
},
122+
});
123+
}}
147124
elevation={2}
148125
css={{
149126
padding:"16px",
@@ -156,8 +133,11 @@ const ChatLanding: FC = () => {
156133
>
157134
<TextField
158135
value={input}
159-
onChange={handleInputChange}
136+
onChange={(event:React.ChangeEvent<HTMLInputElement>)=>{
137+
setInput(event.target.value);
138+
}}
160139
placeholder="Ask Coder..."
140+
required
161141
fullWidth
162142
variant="outlined"
163143
multiline

‎site/src/pages/ChatPage/LanguageModelSelector.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ export const LanguageModelSelector: FC = () => {
3030
);
3131
}
3232

33-
constmodels=languageModelConfig.models??[];
33+
constmodels=Array.from(languageModelConfig.models).toSorted((a,b)=>{
34+
// Sort by provider first, then by display name
35+
constcompareProvider=a.provider.localeCompare(b.provider);
36+
if(compareProvider!==0){
37+
returncompareProvider;
38+
}
39+
returna.display_name.localeCompare(b.display_name);
40+
});
3441

3542
if(models.length===0){
3643
return(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp