fix: 优化提示词模板的创建者的显示
This commit is contained in:
@@ -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>
|
||||
)
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user