这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/src/locales/ar/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ const TRANSLATIONS = {
title: "النداء",
description:
"النداء التي سيتم استخدامه في مساحة العمل هذه. حدد السياق والتعليمات للذكاء الاصطناعي للاستجابة. يجب عليك تقديم نداء مصمم بعناية حتى يتمكن الذكاء الاصطناعي من إنشاء استجابة دقيقة وذات صلة.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "الرد على رفض وضعية الاستعلام",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/da/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"Prompten, der vil blive brugt i dette arbejdsområde. Definér konteksten og instruktionerne til, at AI'en kan generere et svar. Du bør levere en omhyggeligt udformet prompt, så AI'en kan generere et relevant og præcist svar.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Afvisningssvar for forespørgsels-tilstand",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/de/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"Der Prompt, der in diesem Arbeitsbereich verwendet wird. Definieren Sie den Kontext und die Anweisungen für die KI, um eine Antwort zu generieren. Sie sollten einen sorgfältig formulierten Prompt bereitstellen, damit die KI eine relevante und genaue Antwort generieren kann.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Abfragemodus-Ablehnungsantwort",
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/locales/en/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,20 @@ const TRANSLATIONS = {
"Anything more than 45 is likely to lead to continuous chat failures depending on message size.",
},
prompt: {
title: "Prompt",
title: "System Prompt",
description:
"The prompt that will be used on this workspace. Define the context and instructions for the AI to generate a response. You should to provide a carefully crafted prompt so the AI can generate a relevant and accurate response.",
history: {
title: "System Prompt History",
clearAll: "Clear All",
noHistory: "No system prompt history available",
restore: "Restore",
delete: "Delete",
deleteConfirm: "Are you sure you want to delete this history item?",
clearAllConfirm:
"Are you sure you want to clear all history? This action cannot be undone.",
expand: "Expand",
},
},
refusal: {
title: "Query mode refusal response",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/es/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"El prompt que se utilizará en este espacio de trabajo. Define el contexto y las instrucciones para que la IA genere una respuesta. Debes proporcionar un prompt cuidadosamente elaborado para que la IA pueda generar una respuesta relevante y precisa.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Respuesta de rechazo en modo consulta",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/fa/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ const TRANSLATIONS = {
title: "پیش‌متن",
description:
"پیش‌متنی که در این فضای کاری استفاده خواهد شد. زمینه و دستورالعمل‌ها را برای تولید پاسخ توسط هوش مصنوعی تعریف کنید. باید یک پیش‌متن دقیق ارائه دهید تا هوش مصنوعی بتواند پاسخی مرتبط و دقیق تولید کند.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "پاسخ رد در حالت پرس‌وجو",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/fr/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ const TRANSLATIONS = {
title: "Invite",
description:
"L'invite qui sera utilisée sur cet espace de travail. Définissez le contexte et les instructions pour que l'IA génère une réponse. Vous devez fournir une invite soigneusement conçue pour que l'IA puisse générer une réponse pertinente et précise.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Réponse de refus en mode requête",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/he/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ const TRANSLATIONS = {
title: "בקשה",
description:
"הבקשה שתיעשה שימוש בה בסביבת העבודה הזו. הגדר את ההקשר וההוראות עבור ה-AI כדי ליצור תגובה. עליך לספק בקשה מעוצבת בקפידה כדי שה-AI יוכל ליצור תגובה רלוונטית ומדויקת.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "תגובת סירוב במצב שאילתה",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/it/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"Il prompt che verrà utilizzato in quest'area di lavoro. Definisci il contesto e le istruzioni affinché l'IA generi una risposta. Dovresti fornire un prompt elaborato con cura in modo che l'IA possa generare una risposta pertinente e accurata.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Risposta al rifiuto nella modalità di query",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/ja/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ const TRANSLATIONS = {
title: "プロンプト",
description:
"このワークスペースで使用するプロンプトです。AIが適切な応答を生成できるよう、コンテキストや指示を定義してください。",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "クエリモード拒否応答",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/ko/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ const TRANSLATIONS = {
title: "프롬프트",
description:
"이 워크스페이스에서 사용할 프롬프트입니다. AI가 응답을 생성하기 위해 문맥과 지침을 정의합니다. AI가 질문에 대하여 정확한 응답을 생성할 수 있도록 신중하게 프롬프트를 제공해야 합니다.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "쿼리 모드 거부 응답 메시지",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/nl/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"De prompt die in deze werkruimte zal worden gebruikt. Definieer de context en instructies voor de AI om een reactie te genereren. Je moet een zorgvuldig samengestelde prompt geven zodat de AI een relevante en nauwkeurige reactie kan genereren.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Afwijzingsreactie in Querymodus",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/pt_BR/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"O prompt que será usado neste workspace. Defina o contexto e as instruções para que a IA gere uma resposta. Você deve fornecer um prompt cuidadosamente elaborado para que a IA possa gerar uma resposta relevante e precisa.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Resposta de Recusa no Modo de Consulta",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/ru/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ const TRANSLATIONS = {
title: "Подсказка",
description:
"Подсказка, которая будет использоваться в этом рабочем пространстве. Определите контекст и инструкции для AI для создания ответа. Вы должны предоставить тщательно разработанную подсказку, чтобы AI мог генерировать релевантный и точный ответ.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Ответ об отказе в режиме запроса",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/tr/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ const TRANSLATIONS = {
title: "Komut (Prompt)",
description:
"Bu çalışma alanında kullanılacak komut. Yapay zekanın yanıt üretmesi için bağlam ve talimatları tanımlayın. Uygun ve doğru yanıtlar almak için özenle hazırlanmış bir komut sağlamalısınız.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Sorgu Modu Ret Yanıtı",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/vn/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ const TRANSLATIONS = {
title: "Prompt",
description:
"The prompt that will be used on this workspace. Define the context and instructions for the AI to generate a response. You should to provide a carefully crafted prompt so the AI can generate a relevant and accurate response.",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "Query mode refusal response",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/zh/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ const TRANSLATIONS = {
title: "聊天提示",
description:
"将在此工作区上使用的提示。定义 AI 生成响应的上下文和指令。你应该提供精心设计的提示,以便人工智能可以生成相关且准确的响应。",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "查询模式拒绝响应",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/locales/zh_TW/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ const TRANSLATIONS = {
title: "提示詞",
description:
"將在此工作區中使用的提示詞。定義 AI 產生回應的上下文和指示。您應該提供精心設計的提示詞,以便 AI 可以產生相關且準確的回應。",
history: {
title: null,
clearAll: null,
noHistory: null,
restore: null,
delete: null,
deleteConfirm: null,
clearAllConfirm: null,
expand: null,
},
},
refusal: {
title: "查詢模式拒絕回應",
Expand Down
84 changes: 84 additions & 0 deletions frontend/src/models/promptHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { API_BASE } from "@/utils/constants";
import { baseHeaders } from "@/utils/request";

/**
* @typedef {Object} PromptHistory
* @property {number} id - The ID of the prompt history entry
* @property {number} workspaceId - The ID of the workspace
* @property {string} prompt - The prompt text
* @property {number|null} modifiedBy - The ID of the user who modified the prompt
* @property {Date} modifiedAt - The date when the prompt was modified
* @property {Object|null} user - The user who modified the prompt
*/

const PromptHistory = {
/**
* Get all prompt history for a workspace
* @param {number} workspaceId - The ID of the workspace
* @returns {Promise<PromptHistory[]>} - An array of prompt history entries
*/
forWorkspace: async function (workspaceId) {
try {
return await fetch(
`${API_BASE}/workspace/${workspaceId}/prompt-history`,
{
method: "GET",
headers: baseHeaders(),
}
)
.then((res) => res.json())
.then((res) => res.history || [])
.catch((error) => {
console.error("Error fetching prompt history:", error);
return [];
});
} catch (error) {
console.error("Error fetching prompt history:", error);
return [];
}
},

/**
* Delete all prompt history for a workspace
* @param {number} workspaceId - The ID of the workspace
* @returns {Promise<{success: boolean, error: string}>} - A promise that resolves to an object containing a success flag and an error message
*/
clearAll: async function (workspaceId) {
try {
return await fetch(
`${API_BASE}/workspace/${workspaceId}/prompt-history`,
{
method: "DELETE",
headers: baseHeaders(),
}
)
.then((res) => res.json())
.catch((error) => {
console.error("Error clearing prompt history:", error);
return { success: false, error };
});
} catch (error) {
console.error("Error clearing prompt history:", error);
return { success: false, error };
}
},

delete: async function (id) {
try {
return await fetch(`${API_BASE}/workspace/prompt-history/${id}`, {
method: "DELETE",
headers: baseHeaders(),
})
.then((res) => res.json())
.catch((error) => {
console.error("Error deleting prompt history:", error);
return { success: false, error };
});
} catch (error) {
console.error("Error deleting prompt history:", error);
return { success: false, error };
}
},
};

export default PromptHistory;
Loading