Perfectall00 commited on
Commit
3a4eb1c
·
verified ·
1 Parent(s): 546bbc4

اگر خروجی چت معنی آپدیت کل یا آپدیت دکمه یا عملکرد بود کدش رو از بخش چت بگیره و روی خودش اعمال کنه و بر روی هسته فعال کن فایل منابع داخلی اعمال کن تا یادگیری مداوم داشته باشه پیج - Follow Up Deployment

Browse files
Files changed (2) hide show
  1. index.html +93 -0
  2. prompts.txt +2 -1
index.html CHANGED
@@ -1036,6 +1036,14 @@ class AppBuilder:
1036
  }
1037
 
1038
  const generatedCode = data[0].generated_text;
 
 
 
 
 
 
 
 
1039
  document.getElementById('responseContent').innerHTML = `
1040
  <div class="mb-4">
1041
  <p>Generated response:</p>
@@ -1050,6 +1058,10 @@ class AppBuilder:
1050
  <span class="en">Refine</span>
1051
  <span class="fa hidden rtl persian-font">بهینه‌سازی</span>
1052
  </button>
 
 
 
 
1053
  </div>
1054
  `;
1055
  showToast('Code generated successfully', 'success');
@@ -1074,6 +1086,79 @@ class AppBuilder:
1074
 
1075
  // Auto-update related components
1076
  updateRelatedComponents(decodedCode);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1077
  }
1078
 
1079
  function refineResponse(prompt, currentCode) {
@@ -1172,6 +1257,14 @@ class AppBuilder:
1172
  // Initialize on load
1173
  document.addEventListener('DOMContentLoaded', function() {
1174
  initChatUpdates();
 
 
 
 
 
 
 
 
1175
  });
1176
 
1177
  function createPerformanceGraph() {
 
1036
  }
1037
 
1038
  const generatedCode = data[0].generated_text;
1039
+
1040
+ // Check if response contains system update commands
1041
+ if (generatedCode.includes('SYSTEM_UPDATE:')) {
1042
+ const updateCommands = generatedCode.split('SYSTEM_UPDATE:')[1].trim();
1043
+ processSystemUpdate(updateCommands);
1044
+ return;
1045
+ }
1046
+
1047
  document.getElementById('responseContent').innerHTML = `
1048
  <div class="mb-4">
1049
  <p>Generated response:</p>
 
1058
  <span class="en">Refine</span>
1059
  <span class="fa hidden rtl persian-font">بهینه‌سازی</span>
1060
  </button>
1061
+ <button onclick="learnFromResponse('${encodeURIComponent(generatedCode)}')" class="px-3 py-1 bg-purple-500 text-white rounded text-sm">
1062
+ <span class="en">Learn</span>
1063
+ <span class="fa hidden rtl persian-font">یادگیری</span>
1064
+ </button>
1065
  </div>
1066
  `;
1067
  showToast('Code generated successfully', 'success');
 
1086
 
1087
  // Auto-update related components
1088
  updateRelatedComponents(decodedCode);
1089
+
1090
+ // Check for system updates in the code
1091
+ if (decodedCode.includes('SYSTEM_UPDATE:')) {
1092
+ const updateCommands = decodedCode.split('SYSTEM_UPDATE:')[1].trim();
1093
+ processSystemUpdate(updateCommands);
1094
+ }
1095
+ }
1096
+
1097
+ function learnFromResponse(code) {
1098
+ const decodedCode = decodeURIComponent(code);
1099
+ // Save to knowledge base
1100
+ fetch('/api/learn', {
1101
+ method: 'POST',
1102
+ headers: {
1103
+ 'Content-Type': 'application/json',
1104
+ },
1105
+ body: JSON.stringify({
1106
+ content: decodedCode,
1107
+ timestamp: new Date().toISOString()
1108
+ })
1109
+ })
1110
+ .then(response => response.json())
1111
+ .then(data => {
1112
+ showToast('Knowledge updated successfully', 'success');
1113
+ addLogEntry('System learned from new response', 'INFO');
1114
+ })
1115
+ .catch(error => {
1116
+ showToast('Failed to update knowledge', 'error');
1117
+ addLogEntry(`Learning failed: ${error.message}`, 'ERROR');
1118
+ });
1119
+ }
1120
+
1121
+ function processSystemUpdate(commands) {
1122
+ // Parse update commands
1123
+ const updates = commands.split('\n').filter(cmd => cmd.trim());
1124
+
1125
+ updates.forEach(update => {
1126
+ if (update.startsWith('UPDATE_BUTTON:')) {
1127
+ const buttonData = update.split('UPDATE_BUTTON:')[1].trim().split('|');
1128
+ updateButton(buttonData[0], buttonData[1], buttonData[2]);
1129
+ } else if (update.startsWith('UPDATE_FUNCTION:')) {
1130
+ const funcData = update.split('UPDATE_FUNCTION:')[1].trim().split('|');
1131
+ updateFunction(funcData[0], funcData[1]);
1132
+ } else if (update.startsWith('ADD_FEATURE:')) {
1133
+ const featureData = update.split('ADD_FEATURE:')[1].trim();
1134
+ addFeature(featureData);
1135
+ }
1136
+ });
1137
+
1138
+ showToast('System updates applied', 'success');
1139
+ addLogEntry('System updated from chat response', 'INFO');
1140
+ }
1141
+
1142
+ function updateButton(buttonId, newText, newAction) {
1143
+ const button = document.getElementById(buttonId);
1144
+ if (button) {
1145
+ button.textContent = newText;
1146
+ button.setAttribute('onclick', newAction);
1147
+ showToast(`Button ${buttonId} updated`, 'info');
1148
+ }
1149
+ }
1150
+
1151
+ function updateFunction(funcName, newCode) {
1152
+ // In a real implementation, this would update the actual function
1153
+ // For demo, we'll just log it
1154
+ console.log(`Function ${funcName} updated with:`, newCode);
1155
+ addLogEntry(`Function ${funcName} updated`, 'INFO');
1156
+ }
1157
+
1158
+ function addFeature(featureCode) {
1159
+ // In a real implementation, this would add new features
1160
+ console.log('New feature added:', featureCode);
1161
+ addLogEntry('New feature added from chat', 'INFO');
1162
  }
1163
 
1164
  function refineResponse(prompt, currentCode) {
 
1257
  // Initialize on load
1258
  document.addEventListener('DOMContentLoaded', function() {
1259
  initChatUpdates();
1260
+ // Load initial knowledge
1261
+ fetch('/api/knowledge')
1262
+ .then(response => response.json())
1263
+ .then(data => {
1264
+ if (data.length > 0) {
1265
+ addLogEntry(`Loaded ${data.length} knowledge entries`, 'INFO');
1266
+ }
1267
+ });
1268
  });
1269
 
1270
  function createPerformanceGraph() {
prompts.txt CHANGED
@@ -75,4 +75,5 @@ Check out the configuration
75
  ارو میاد روی فضای برنامه.configuration error
76
  Missing configuration in READMEدرستش کن
77
  خوب پیش نیازها رو باز دوباره بنویس آپدیت کنhttps://huggingface.co/docs/hub/spaces-config-reference ارور کانفیگوریشن رو برطرف کن
78
- این بخش باید یتونه خودش رو آپدیت کنه کل بخش های دیگه از طریق خروجی این چت ارتقاء پیدا کنن یعنی ادامه دستوراتی که اینجا به تو میدم اونجا توی چت فعل باشه و اعمال خروجی بروی خود داشته باشه
 
 
75
  ارو میاد روی فضای برنامه.configuration error
76
  Missing configuration in READMEدرستش کن
77
  خوب پیش نیازها رو باز دوباره بنویس آپدیت کنhttps://huggingface.co/docs/hub/spaces-config-reference ارور کانفیگوریشن رو برطرف کن
78
+ این بخش باید یتونه خودش رو آپدیت کنه کل بخش های دیگه از طریق خروجی این چت ارتقاء پیدا کنن یعنی ادامه دستوراتی که اینجا به تو میدم اونجا توی چت فعل باشه و اعمال خروجی بروی خود داشته باشه
79
+ اگر خروجی چت معنی آپدیت کل یا آپدیت دکمه یا عملکرد بود کدش رو از بخش چت بگیره و روی خودش اعمال کنه و بر روی هسته فعال کن فایل منابع داخلی اعمال کن تا یادگیری مداوم داشته باشه پیج