瀏覽代碼

feat: provide directory information to the agent from FE (#4622)

Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
Xingyao Wang 1 年之前
父節點
當前提交
89406bac44
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      frontend/src/routes/_oh.app.tsx

+ 11 - 1
frontend/src/routes/_oh.app.tsx

@@ -235,13 +235,23 @@ function App() {
 
         // handle new session
         if (!token) {
+          let additionalInfo = "";
           if (ghToken && repo) {
             send(getCloneRepoCommand(ghToken, repo));
+            additionalInfo = `Repository ${repo} has been cloned to /workspace. Please check the /workspace for files.`;
             dispatch(clearSelectedRepository()); // reset selected repository; maybe better to move this to '/'?
           }
+          // if there's an uploaded project zip, add it to the chat
+          else if (importedProjectZip) {
+            additionalInfo = `Files have been uploaded. Please check the /workspace for files.`;
+          }
 
           if (q) {
-            sendInitialQuery(q, files);
+            if (additionalInfo) {
+              sendInitialQuery(`${q}\n\n[${additionalInfo}]`, files);
+            } else {
+              sendInitialQuery(q, files);
+            }
             dispatch(clearFiles()); // reset selected files
           }
         }