| last_ans = "" | last_ans = "" | ||||
| delta_ans = "" | delta_ans = "" | ||||
| for ans in chat_mdl.chat_streamly(prompt_config.get("system", ""), msg, dialog.llm_setting): | for ans in chat_mdl.chat_streamly(prompt_config.get("system", ""), msg, dialog.llm_setting): | ||||
| if ans == None: continue # SSDESK: 修复RKLLM返回信息没有终止符的问题 | |||||
| answer = ans | answer = ans | ||||
| delta_ans = ans[len(last_ans) :] | delta_ans = ans[len(last_ans) :] | ||||
| if num_tokens_from_string(delta_ans) < 16: | if num_tokens_from_string(delta_ans) < 16: |
| export default defineConfig({ | export default defineConfig({ | ||||
| title: appName, | title: appName, | ||||
| outputPath: 'dist', | |||||
| outputPath: 'dist/ss-rag', | |||||
| alias: { '@parent': path.resolve(__dirname, '../') }, | alias: { '@parent': path.resolve(__dirname, '../') }, | ||||
| npmClient: 'npm', | npmClient: 'npm', | ||||
| base: '/', | |||||
| base: '/ss-rag/', | |||||
| routes, | routes, | ||||
| publicPath: '/', | |||||
| publicPath: '/ss-rag/', | |||||
| esbuildMinifyIIFE: true, | esbuildMinifyIIFE: true, | ||||
| icons: {}, | icons: {}, | ||||
| hash: true, | hash: true, | ||||
| history: { | history: { | ||||
| type: 'browser', | type: 'browser', | ||||
| }, | }, | ||||
| exportStatic: {}, | |||||
| plugins: [ | plugins: [ | ||||
| '@react-dev-inspector/umi4-plugin', | '@react-dev-inspector/umi4-plugin', | ||||
| '@umijs/plugins/dist/tailwindcss', | '@umijs/plugins/dist/tailwindcss', |
| }, []); | }, []); | ||||
| const generateIframeSrc = () => { | const generateIframeSrc = () => { | ||||
| let src = `${location.origin}/chat/share?shared_id=${token}&from=${form}&auth=${beta}`; | |||||
| let src = `${location.origin}/ss-rag/chat/share?shared_id=${token}&from=${form}&auth=${beta}`; | |||||
| if (visibleAvatar) { | if (visibleAvatar) { | ||||
| src += '&visible_avatar=1'; | src += '&visible_avatar=1'; | ||||
| } | } |
| const getUrlWithToken = (token: string, from: string = 'chat') => { | const getUrlWithToken = (token: string, from: string = 'chat') => { | ||||
| const { protocol, host } = window.location; | const { protocol, host } = window.location; | ||||
| return `${protocol}//${host}/chat/share?shared_id=${token}&from=${from}`; | |||||
| return `${protocol}//${host}/ss-rag/chat/share?shared_id=${token}&from=${from}`; | |||||
| }; | }; | ||||
| const useFetchTokenListBeforeOtherStep = () => { | const useFetchTokenListBeforeOtherStep = () => { |
| let nextLink = link; | let nextLink = link; | ||||
| const extension = getExtension(documentName); | const extension = getExtension(documentName); | ||||
| if (!link) { | if (!link) { | ||||
| nextLink = `/document/${documentId}?ext=${extension}&prefix=${prefix}`; | |||||
| nextLink = `/ss-rag/document/${documentId}?ext=${extension}&prefix=${prefix}`; | |||||
| } | } | ||||
| return ( | return ( |
| { | { | ||||
| "appName": "RAGFlow" | |||||
| "appName": "浩瀚知图" | |||||
| } | } |
| useCreateNextSharedConversation(); | useCreateNextSharedConversation(); | ||||
| const { handleInputChange, value, setValue } = useHandleMessageInputChange(); | const { handleInputChange, value, setValue } = useHandleMessageInputChange(); | ||||
| const { send, answer, done, stopOutputMessage } = useSendMessageWithSse( | const { send, answer, done, stopOutputMessage } = useSendMessageWithSse( | ||||
| `/api/v1/${from === SharedFrom.Agent ? 'agentbots' : 'chatbots'}/${conversationId}/completions`, | |||||
| `/ss-rag-api/api/v1/${from === SharedFrom.Agent ? 'agentbots' : 'chatbots'}/${conversationId}/completions`, | |||||
| ); | ); | ||||
| const { | const { | ||||
| derivedMessages, | derivedMessages, |
| let api_host = `/v1`; | |||||
| let api_host = `/ss-rag-api/v1`; | |||||
| export { api_host }; | export { api_host }; | ||||
| // Will not jump to the login page | // Will not jump to the login page | ||||
| export function redirectToLogin() { | export function redirectToLogin() { | ||||
| window.location.href = location.origin + `/login`; | |||||
| window.location.href = location.origin + `/ss-rag/login`; | |||||
| } | } |