|
|
@@ -627,6 +627,7 @@ export function ChatActions(props: {
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ setGuessList([]);
|
|
|
const messages = session.messages.slice();
|
|
|
if (messages.length > 1) {
|
|
|
const backList = messages.reverse();
|
|
|
@@ -659,6 +660,7 @@ export function ChatActions(props: {
|
|
|
}}
|
|
|
onClick={() => {
|
|
|
props.setUserInput(item);
|
|
|
+ props.doSubmit(item)
|
|
|
}}
|
|
|
key={index}
|
|
|
>
|
|
|
@@ -974,11 +976,7 @@ function _Chat() {
|
|
|
const [appList, setAppList] = useState<AppList>([]);
|
|
|
const [appValue, setAppValue] = useState<string>();
|
|
|
const globalStore = useGlobalStore();
|
|
|
- type QuestionList = {
|
|
|
- key: string,
|
|
|
- title: string,
|
|
|
- content: string,
|
|
|
- }[];
|
|
|
+ type QuestionList = string[];
|
|
|
const [questionList, setQuestionList] = useState<QuestionList>([]);
|
|
|
const location = useLocation();
|
|
|
|
|
|
@@ -1018,9 +1016,10 @@ function _Chat() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const fetchDefaultQuestion = async () => {
|
|
|
+ // 获取预设问题列表
|
|
|
+ const fetchDefaultQuestion = async (appId: string) => {
|
|
|
try {
|
|
|
- const res = await api.get('/bigmodel/api/presets');
|
|
|
+ const res = await api.get(`/bigmodel/api/presets/${appId}`);
|
|
|
setQuestionList(res.data);
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
|
@@ -1031,13 +1030,18 @@ function _Chat() {
|
|
|
|
|
|
const init = async () => {
|
|
|
await fetchApplicationList();
|
|
|
- await fetchDefaultQuestion();
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
init();
|
|
|
}, [])
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (appValue) {
|
|
|
+ fetchDefaultQuestion(appValue);
|
|
|
+ }
|
|
|
+ }, [appValue])
|
|
|
+
|
|
|
const [inputRows, setInputRows] = useState(2);
|
|
|
const measure = useDebouncedCallback(
|
|
|
() => {
|
|
|
@@ -1912,12 +1916,13 @@ function _Chat() {
|
|
|
cursor: 'pointer'
|
|
|
}}
|
|
|
onClick={() => {
|
|
|
- setUserInput(item.content)
|
|
|
+ setUserInput(item)
|
|
|
+ doSubmit(item)
|
|
|
}}
|
|
|
key={index}
|
|
|
>
|
|
|
<div>
|
|
|
- {item.title}
|
|
|
+ {item}
|
|
|
</div>
|
|
|
<RightOutlined />
|
|
|
</div>
|