mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-13 13:07:32 +00:00
[feature](chat-sdk) optimize
This commit is contained in:
@@ -86,13 +86,13 @@ const ChatItem: React.FC<Props> = ({
|
|||||||
const onSendMsg = async () => {
|
const onSendMsg = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const semanticRes = await chatQuery(msg, conversationId, classId);
|
const semanticRes = await chatQuery(msg, conversationId, classId);
|
||||||
const semanticValid = updateData(semanticRes.data);
|
updateData(semanticRes.data);
|
||||||
if (suggestionEnable && semanticValid) {
|
// if (suggestionEnable && semanticValid) {
|
||||||
const semanticResData = semanticRes.data.data;
|
// const semanticResData = semanticRes.data.data;
|
||||||
await getSuggestions(semanticResData.entityInfo?.domainInfo?.itemId, semanticRes.data.data);
|
// await getSuggestions(semanticResData.entityInfo?.domainInfo?.itemId, semanticRes.data.data);
|
||||||
} else {
|
// } else {
|
||||||
setSuggestionData(undefined);
|
// setSuggestionData(undefined);
|
||||||
}
|
// }
|
||||||
if (onLastMsgDataLoaded) {
|
if (onLastMsgDataLoaded) {
|
||||||
onLastMsgDataLoaded(semanticRes.data.data);
|
onLastMsgDataLoaded(semanticRes.data.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import axios from './axiosInstance';
|
|||||||
import { ChatContextType, HistoryType, MsgDataType, SearchRecommendItem } from '../common/type';
|
import { ChatContextType, HistoryType, MsgDataType, SearchRecommendItem } from '../common/type';
|
||||||
import { QueryDataType } from '../common/type';
|
import { QueryDataType } from '../common/type';
|
||||||
|
|
||||||
const DEFAULT_CHAT_ID = 0;
|
const DEFAULT_CHAT_ID = 2;
|
||||||
|
|
||||||
const prefix = '/api';
|
const prefix = '/api';
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
const { createProxyMiddleware } = require('http-proxy-middleware');
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
||||||
|
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
// app.use(
|
|
||||||
// '/api',
|
|
||||||
// createProxyMiddleware({
|
|
||||||
// target: 'http://10.91.206.71:9079',
|
|
||||||
// changeOrigin: true,
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api',
|
'/api',
|
||||||
// '/api',
|
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: 'http://supersonic.test.tmeoa.com',
|
target: 'http://localhost:9080',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -160,13 +160,6 @@ export function getChartLightenColor(col) {
|
|||||||
export const isMobile = window.navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i);
|
export const isMobile = window.navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i);
|
||||||
|
|
||||||
|
|
||||||
export function isProd() {
|
|
||||||
return (
|
|
||||||
window.location.origin.includes('tmeoa.com') ||
|
|
||||||
window.location.hostname === 's2.tencentmusic.com'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setToken(token: string) {
|
export function setToken(token: string) {
|
||||||
localStorage.setItem('SUPERSONIC_CHAT_TOKEN', token);
|
localStorage.setItem('SUPERSONIC_CHAT_TOKEN', token);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user