Compare commits

...

3 Commits

Author SHA1 Message Date
liuhengshu 87bc88600e fix:开源仓嵌入方式
Context testing / dump_contexts_to_log (push) Successful in 1m34s Details
Context testing / run-02 (push) Successful in 4m7s Details
Context testing / run-01 (push) Successful in 4m9s Details
Context testing / run-04 (push) Successful in 5m2s Details
Context testing / run-03 (push) Successful in 5m6s Details
2026-07-31 09:26:39 +08:00
谢思 6409ad6940 智能体登录直接调用agent服务,不走微服务
Context testing / run-01 (push) Failing after 55s Details
Context testing / run-02 (push) Failing after 56s Details
Context testing / run-03 (push) Failing after 55s Details
Context testing / run-04 (push) Failing after 56s Details
Context testing / dump_contexts_to_log (push) Failing after 56s Details
2026-07-24 17:53:56 +08:00
谢思 5aae70e4c7 头像地址处理
Context testing / run-01 (push) Failing after 54s Details
Context testing / run-02 (push) Failing after 55s Details
Context testing / run-03 (push) Failing after 55s Details
Context testing / run-04 (push) Failing after 55s Details
Context testing / dump_contexts_to_log (push) Failing after 55s Details
2026-07-23 17:30:20 +08:00
10 changed files with 144 additions and 17 deletions

View File

@ -56,4 +56,4 @@ export const deepRoutes = [
] ]
// 不进行组织或个人判断 // 不进行组织或个人判断
export const specialRoute = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone", "undefined", "admins", "oauth", "competitions", "hiagent","sf", "development", "governance"] export const specialRoute = ["ossRepo", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone", "undefined", "admins", "oauth", "competitions", "hiagent","sf", "development", "governance","explore"]

View File

@ -236,6 +236,11 @@ const GovernanceIframe = Loadable({
loading: Loading, loading: Loading,
}); });
const OssRepoIframe = Loadable({
loader: () => import("./forge/ossRepoIframe"),
loading: Loading,
});
const Forums = Loadable({ const Forums = Loadable({
loader: () => import("./forums"), loader: () => import("./forums"),
loading: Loading, loading: Loading,
@ -252,7 +257,7 @@ const AI = Loadable({
}); });
// 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。 // 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。
const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone", "hiagent","sf", "development", "governance", "forums", "news", "exploreStore", "factory", "zoneAdmin", "ai"]; const keyWord = ["ossRepo", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone", "hiagent","sf", "development", "governance", "explore","forums", "news", "exploreStore", "factory", "zoneAdmin", "ai"];
class App extends Component { class App extends Component {
constructor(props) { constructor(props) {
@ -636,7 +641,7 @@ class App extends Component {
<Route path="/search" component={Search} mygetHelmetapi={mygetHelmetapi} /> <Route path="/search" component={Search} mygetHelmetapi={mygetHelmetapi} />
{/* 项目标签列表页 */} {/* 项目标签列表页 */}
<Route path="/explore/topic/:id/:name" component={Topic} mygetHelmetapi={mygetHelmetapi} /> <Route path="/ossRepo/topic/:id/:name" component={Topic} mygetHelmetapi={mygetHelmetapi} />
<Route path={"/:OIdentifier/enterprise"} <Route path={"/:OIdentifier/enterprise"}
render={ render={
@ -723,7 +728,7 @@ class App extends Component {
<Projects {...this.props} {...props} /> <Projects {...this.props} {...props} />
)} )}
></Route> ></Route>
<Route exact path="/explore" <Route exact path="/ossRepo"
render={ render={
(props) => ( (props) => (
<Projects {...this.props} {...props} {...this.state}/> <Projects {...this.props} {...props} {...this.state}/>
@ -745,6 +750,15 @@ class App extends Component {
}> }>
</Route> </Route>
<Route
path={"/explore"}
render={
(props) => {
return (<OssRepoIframe {...this.props} {...props} {...this.state} />)
}
}>
</Route>
<Route <Route
path={"/factory"} path={"/factory"}
render={ render={

View File

@ -1,4 +1,5 @@
import fetch from './fetch'; import fetch from './fetch';
import fetchLogin from './fetchLogin';
/**智能体分类列表***/ /**智能体分类列表***/
export function getAgentTypeList(params) { export function getAgentTypeList(params) {
@ -16,4 +17,13 @@ export function getAgentList(params) {
method: 'get', method: 'get',
params params
}); });
}
/**智能体登录***/
export function agentLogin(data) {
return fetchLogin({
url: `/api/login/oauth/access_token`,
method: 'post',
data
});
} }

View File

@ -3,6 +3,7 @@ import { withRouter } from "react-router";
import { httpUrl } from '../../ai/fetch'; import { httpUrl } from '../../ai/fetch';
import cookie from 'react-cookies'; import cookie from 'react-cookies';
import { aiAgentLogin } from "../../forge/Information/api"; import { aiAgentLogin } from "../../forge/Information/api";
import { agentLogin } from "../api";
function Agent(props) { function Agent(props) {
const { match, current_user, history, showLoginDialog } = props; const { match, current_user, history, showLoginDialog } = props;
@ -30,15 +31,21 @@ function Agent(props) {
if (!agentCookie) { if (!agentCookie) {
// Cookieagent // Cookieagent
const res = await aiAgentLogin(); const res = await agentLogin({
grant_type: 'password',
client_id: '4b25ca036879216a020a',
username: 'hnxjy',
password: '123456',
scope: 'profile'
});
if (res && res.data && res.data.data) { if (res && res.data && res.data) {
const { accessToken, expiresAt, expiresIn } = res.data.data; const { access_token, expires_in } = res.data;
// expiresAtexpiresIn // + expires_in
const expiryDate = new Date(expiresAt + expiresIn); const expiryDate = new Date(Date.now() + (expires_in) * 1000);
// tokenagent Cookie // tokenagent Cookie
currentTokenData = accessToken; currentTokenData = access_token;
cookie.save('agent', currentTokenData, { expires: expiryDate, path: '/' }); cookie.save('agent', currentTokenData, { expires: expiryDate, path: '/' });
} }
} else { } else {

61
src/ai/fetchLogin.js Normal file
View File

@ -0,0 +1,61 @@
import axios from 'axios';
import { message , notification } from 'antd';
import cookie from 'react-cookies';
function beforeFetch(actionUrl){
if (window.location.href.indexOf('localhost') < 0) {
axios.defaults.withCredentials = true;
}
const config = {
// headers:{Authorization:"Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjo0NCwidXNlcl9rZXkiOiI3NWY3MmJmYmE2NGU4N2U3NWVjNWMwZDk2OThkMDFiN2EyODE0YjYwIiwidXNlcm5hbWUiOiJpbm5vdiJ9.IviAyZQjPFc4rT3ejAKfJYx3_QgS78RCKHx1XS-A4uI_mrc7_l6wK76HVIoPCEvP0Qimzyc6dpeVW4cE2fILZw"},
baseURL: actionUrl,
timeout: 1800000, // 请求超时时间
}
const service = axios.create(config);
service.interceptors.request.use(request => {
// let deptId = sessionStorage.getItem('deptId')
// request.headers.Authorization = cookie.load('autologin_trustie')
// if (deptId) {
// // 用于权限区分
// request.headers['Dept-Id'] = deptId
// }
return request
})
service.interceptors.response.use(
response => {
const res = response||{};
if(res && res.data && res.data.code === 404){
message.error("错误链接!");
window.location.href = '/nopage';
return Promise.reject('error');
}else if(res && res.data && res.data.code === 500){
message.error(res.data.msg);
return Promise.reject('error');
}else{
return response;
}
},
error => {
console.log(error);
// notification.open({
// message: "提示",
// description: error.message,
// });
// return Promise.reject(error);
}
)
return service;
}
let settings = localStorage.chromesetting&& localStorage.chromesetting !=="undefined"&& JSON.parse(localStorage.chromesetting);
// 根据当前IP判断使用哪个zone配置
const isSpecificIP = window.location.hostname.startsWith('27.');
// let actionUrl = settings && (isSpecificIP ? settings.common.zone : settings.common.zone_local) + '/zoneAdmin/api';
let actionUrl = settings && settings.common && settings.common.agent_login;
const service = beforeFetch(actionUrl);
export const httpUrl = actionUrl;
export default service;

View File

@ -249,10 +249,12 @@ function List(props) {
if (res && res.data && res.data.rows) { if (res && res.data && res.data.rows) {
setList(res.data.rows.map(row => { setList(res.data.rows.map(row => {
const { projectProperties, id } = row; const { projectProperties, id } = row;
const imageUrl = projectProperties.authorImageUrl.split(':4000/') && projectProperties.authorImageUrl.split(':4000/')[1]
const authorImageUrl = imageUrl ? `${window.location.origin}/${imageUrl}` : projectProperties.authorImageUrl
return { return {
id: id, id: id,
name: projectProperties.fromOwner === "AI-RESOURCE" ? projectProperties.name.split("/").pop() : projectProperties.name, name: projectProperties.fromOwner === "AI-RESOURCE" ? projectProperties.name.split("/").pop() : projectProperties.name,
image: projectProperties.authorImageUrl, image: authorImageUrl,
isNew: false, isNew: false,
url: projectProperties.fullName, url: projectProperties.fullName,
desc: projectProperties.description, desc: projectProperties.description,
@ -398,9 +400,9 @@ function List(props) {
{list.map((model) => ( {list.map((model) => (
<ActionItem key={`${type}-${model.id}`} className="ai_home_card" padding="1px" borderRadius="12px"> <ActionItem key={`${type}-${model.id}`} className="ai_home_card" padding="1px" borderRadius="12px">
{type === "agents" ? <div> {type === "agents" ? <div>
<div> <div className="df">
<img src={model.image ? model.image : require(`../image/${model.id}.png`).default} width={46} className="mr15" style={{ borderRadius: '8px' }} /> <img src={model.image ? model.image : require(`../image/${model.id}.png`).default} width={46} className="mr15" style={{ borderRadius: '8px' }} />
<span className="font-18 font-bd">{model.name}</span> <span className="font-18 font-bd task-hide">{model.name}</span>
</div> </div>
<div className="color3f4 mt15 task-hide-2" style={{minHeight: 56}}>{model.desc}</div> <div className="color3f4 mt15 task-hide-2" style={{minHeight: 56}}>{model.desc}</div>
<div className="btn-Box"> <div className="btn-Box">

View File

@ -350,7 +350,7 @@ class NewHeader extends Component {
}, },
{ {
"name": "开源软件仓库", "name": "开源软件仓库",
"link": "/explore", "link": "/ossRepo",
"index": "2", "index": "2",
"hidden": false "hidden": false
}, },

View File

@ -72,7 +72,7 @@ class Index extends Component {
></Route> ></Route>
<Route <Route
path="/explore" path="/ossRepo"
render={(props) => ( render={(props) => (
<ProjectHome {...this.props} {...props} /> <ProjectHome {...this.props} {...props} />
)} )}

View File

@ -0,0 +1,31 @@
import React, { useEffect, useState } from "react";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
import loadingGIf from "./Images/loading.gif";
function OssRepo(props) {
const {current_user, mygetHelmetapi} = props;
const {admin, user_id} = current_user || {}
const {common} = mygetHelmetapi || {};
const {ossRepo="http://27.122.114.160:3001"} = common || {};
const [loading, setLoading] = useState(true);
useEffect(()=>{
document.title = '开源软件仓库';
// document.body.style.background = '#fff';
return () => {
document.body.style.background = '';
}
}, [])
const url = `${ossRepo}/?uid=${user_id === 2 ? undefined : user_id}`
// const url = "http://localhost:3007/"
return <div className="" style={{border: "none"}}>
{loading && <div className="center" style={{minHeight: '60vh', marginTop: '30vh'}}>
<img src={loadingGIf} width={250}/>
<div className="font-16" style={{position: 'relative', top: '-40px', color: '#091221', opacity: '0.6'}}>加载中请耐心等待</div>
</div>}
<iframe title={`ossRepoIframe`} src={url} id={`ossRepoIframe`} frameBorder="0" name={`ossRepoIframe`} width="100%" style={{height: '100vh', border: 'none'}} onLoad={()=>{setLoading(false)}}></iframe>
</div>
}
export default TPMIndexHOC(OssRepo);

View File

@ -26,7 +26,9 @@ function ForumList({title="最新帖子", forumList, LIMIT, page, setPage, total
</div> </div>
<div className="forums-list4-box pt5"> <div className="forums-list4-box pt5">
{forumList.map((item, index) => { {forumList.map((item, index) => {
const orderIndex = index+LIMIT*(page-1) const orderIndex = index+LIMIT*(page-1);
const imageUrl = item.image_url.split(':4000/') && item.image_url.split(':4000/')[1]
const authorImageUrl = imageUrl ? `${window.location.origin}/${imageUrl}` : item.image_url
return <div className="forums-list4-item"> return <div className="forums-list4-item">
<div className="pr80 AlignCenter"> <div className="pr80 AlignCenter">
{orderIndex < 3 ? <img src={sortImg1[orderIndex]} width={24} className="mr10"/> : <span className="font-bd font-20 mr10">{orderIndex + 1}</span>} {orderIndex < 3 ? <img src={sortImg1[orderIndex]} width={24} className="mr10"/> : <span className="font-bd font-20 mr10">{orderIndex + 1}</span>}
@ -39,7 +41,7 @@ function ForumList({title="最新帖子", forumList, LIMIT, page, setPage, total
<i className="iconfont icon-jiantou21 font-16"></i> <i className="iconfont icon-jiantou21 font-16"></i>
</div> </div>
<div className="opacity8 mt15 forums-list4-item-bottom"> <div className="opacity8 mt15 forums-list4-item-bottom">
<img src={item.image_url} alt="" className="user-img" /> <img src={authorImageUrl} alt="" className="user-img" />
{item.username} {item.username}
<span className="ml10">{item.published_time}</span> <span className="ml10">{item.published_time}</span>
<Divider type="vertical" /> <Divider type="vertical" />