Bläddra i källkod

feat: ss-rag适配修改

Hacked_v0.18.0
fellow99 6 månader sedan
förälder
incheckning
2589a302fb

+ 5
- 2
Dockerfile Visa fil

RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co,target=/huggingface.co \ RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/huggingface.co,target=/huggingface.co \
if [ "$LIGHTEN" != "1" ]; then \ if [ "$LIGHTEN" != "1" ]; then \
(tar -cf - \ (tar -cf - \
/huggingface.co/BAAI/bge-large-zh-v1.5 \
/huggingface.co/maidalun1020/bce-embedding-base_v1 \
/huggingface.co/BAAI/bge-small-zh-v1.5 \
# /huggingface.co/BAAI/bge-large-zh-v1.5 \
# /huggingface.co/BAAI/bge-reranker-v2-m3 \
# /huggingface.co/maidalun1020/bce-embedding-base_v1 \
# /huggingface.co/maidalun1020/bce-reranker-base_v1 \
| tar -xf - --strip-components=2 -C /root/.ragflow) \ | tar -xf - --strip-components=2 -C /root/.ragflow) \
fi fi



+ 1
- 0
api/db/services/dialog_service.py Visa fil

last_ans = "" last_ans = ""
answer = "" answer = ""
for ans in chat_mdl.chat_streamly(prompt + prompt4citation, msg[1:], gen_conf): for ans in chat_mdl.chat_streamly(prompt + prompt4citation, msg[1:], gen_conf):
if ans == None: continue # SSDESK: 修复RKLLM返回信息没有终止符的问题
if thought: if thought:
ans = re.sub(r"<think>.*</think>", "", ans, flags=re.DOTALL) ans = re.sub(r"<think>.*</think>", "", ans, flags=re.DOTALL)
answer = ans answer = ans

+ 5
- 2
download_deps.py Visa fil

"InfiniFlow/text_concat_xgb_v1.0", "InfiniFlow/text_concat_xgb_v1.0",
"InfiniFlow/deepdoc", "InfiniFlow/deepdoc",
"InfiniFlow/huqie", "InfiniFlow/huqie",
"BAAI/bge-large-zh-v1.5",
"maidalun1020/bce-embedding-base_v1",
"BAAI/bge-small-zh-v1.5",
# "BAAI/bge-large-zh-v1.5",
# "BAAI/bge-reranker-v2-m3",
# "maidalun1020/bce-embedding-base_v1",
# "maidalun1020/bce-reranker-base_v1",
] ]


def download_model(repo_id): def download_model(repo_id):

+ 4
- 3
web/.umirc.ts Visa fil



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',

+ 1
- 1
web/src/components/api-service/embed-modal/index.tsx Visa fil

}, []); }, []);


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';
} }

+ 1
- 1
web/src/components/api-service/hooks.ts Visa fil



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 = () => {

+ 1
- 1
web/src/components/new-document-link.tsx Visa fil

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 (

+ 1
- 1
web/src/conf.json Visa fil

{ {
"appName": "RAGFlow"
"appName": "浩瀚知图"
} }

+ 1
- 1
web/src/pages/chat/shared-hooks.ts Visa fil

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,

+ 1
- 1
web/src/utils/api.ts Visa fil

let api_host = `/v1`;
let api_host = `/ss-rag-api/v1`;


export { api_host }; export { api_host };



+ 1
- 1
web/src/utils/authorization-util.ts Visa fil



// 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`;
} }

Laddar…
Avbryt
Spara