mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
Merge pull request #194 from Icyoung/dev
Remote auth for prompt templates
This commit is contained in:
+4
-3
@@ -84,6 +84,10 @@ func (s *Server) setupRoutes() {
|
|||||||
|
|
||||||
// 系统配置(无需认证)
|
// 系统配置(无需认证)
|
||||||
api.GET("/config", s.handleGetSystemConfig)
|
api.GET("/config", s.handleGetSystemConfig)
|
||||||
|
|
||||||
|
// 系统提示词模板管理(无需认证)
|
||||||
|
api.GET("/prompt-templates", s.handleGetPromptTemplates)
|
||||||
|
api.GET("/prompt-templates/:name", s.handleGetPromptTemplate)
|
||||||
|
|
||||||
// 需要认证的路由
|
// 需要认证的路由
|
||||||
protected := api.Group("/", s.authMiddleware())
|
protected := api.Group("/", s.authMiddleware())
|
||||||
@@ -110,9 +114,6 @@ func (s *Server) setupRoutes() {
|
|||||||
protected.GET("/user/signal-sources", s.handleGetUserSignalSource)
|
protected.GET("/user/signal-sources", s.handleGetUserSignalSource)
|
||||||
protected.POST("/user/signal-sources", s.handleSaveUserSignalSource)
|
protected.POST("/user/signal-sources", s.handleSaveUserSignalSource)
|
||||||
|
|
||||||
// 系统提示词模板管理
|
|
||||||
protected.GET("/prompt-templates", s.handleGetPromptTemplates)
|
|
||||||
protected.GET("/prompt-templates/:name", s.handleGetPromptTemplate)
|
|
||||||
|
|
||||||
// 竞赛总览
|
// 竞赛总览
|
||||||
protected.GET("/competition", s.handleCompetition)
|
protected.GET("/competition", s.handleCompetition)
|
||||||
|
|||||||
@@ -120,12 +120,7 @@ export function TraderConfigModal({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchPromptTemplates = async () => {
|
const fetchPromptTemplates = async () => {
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('token');
|
const response = await fetch('/api/prompt-templates');
|
||||||
const response = await fetch('/api/prompt-templates', {
|
|
||||||
headers: {
|
|
||||||
'Authorization': `Bearer ${token}`
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
if (data.templates) {
|
if (data.templates) {
|
||||||
setPromptTemplates(data.templates);
|
setPromptTemplates(data.templates);
|
||||||
|
|||||||
Reference in New Issue
Block a user