fix: 优化提示词模板的创建者的显示

This commit is contained in:
2025-11-06 14:51:31 +08:00
parent 34cba4a34f
commit b99ae6df84
4 changed files with 25 additions and 39 deletions
+2 -1
View File
@@ -334,7 +334,8 @@ export default function PromptsIndex() {
key: "created_by",
width: "100px",
render: (_: unknown, record: PromptTemplateUI) => (
<span className="text-secondary"> {record.created_by}</span>
// <span className="text-secondary">用户 {record.created_by}</span>
<span className="text-secondary">{record.created_by_username}</span>
)
},
{
+3 -2
View File
@@ -109,8 +109,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
// Action函数 - 处理表单提交
export async function action({ request }: ActionFunctionArgs) {
const { getUserSession } = await import("~/api/login/auth.server");
const { frontendJWT } = await getUserSession(request);
const { userInfo, frontendJWT } = await getUserSession(request);
const userId = userInfo.get('user_id')
const formData = await request.formData();
const id = formData.get("id") as string;
const template_name = formData.get("template_name") as string;
@@ -168,7 +169,7 @@ export async function action({ request }: ActionFunctionArgs) {
result = await updatePromptTemplate(id, apiTemplate, frontendJWT);
} else {
// 创建模板
result = await createPromptTemplate(apiTemplate, frontendJWT);
result = await createPromptTemplate(apiTemplate, userId, frontendJWT);
}
if (result.error) {