Merge pull request #194 from Icyoung/dev

Remote auth for prompt templates
This commit is contained in:
tinkle-community
2025-11-01 20:34:32 +08:00
committed by GitHub
2 changed files with 5 additions and 9 deletions
+4 -3
View File
@@ -84,6 +84,10 @@ func (s *Server) setupRoutes() {
// 系统配置(无需认证)
api.GET("/config", s.handleGetSystemConfig)
// 系统提示词模板管理(无需认证)
api.GET("/prompt-templates", s.handleGetPromptTemplates)
api.GET("/prompt-templates/:name", s.handleGetPromptTemplate)
// 需要认证的路由
protected := api.Group("/", s.authMiddleware())
@@ -110,9 +114,6 @@ func (s *Server) setupRoutes() {
protected.GET("/user/signal-sources", s.handleGetUserSignalSource)
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)
+1 -6
View File
@@ -120,12 +120,7 @@ export function TraderConfigModal({
useEffect(() => {
const fetchPromptTemplates = async () => {
try {
const token = localStorage.getItem('token');
const response = await fetch('/api/prompt-templates', {
headers: {
'Authorization': `Bearer ${token}`
}
});
const response = await fetch('/api/prompt-templates');
const data = await response.json();
if (data.templates) {
setPromptTemplates(data.templates);