Browse Source

fix(web): remove system prompts from share page

adamdottv 8 months ago
parent
commit
dbb6e55226
1 changed files with 10 additions and 81 deletions
  1. 10 81
      packages/web/src/components/Share.tsx

+ 10 - 81
packages/web/src/components/Share.tsx

@@ -23,7 +23,6 @@ import {
 } from "./icons/custom"
 } from "./icons/custom"
 import {
 import {
   IconFolder,
   IconFolder,
-  IconCpuChip,
   IconHashtag,
   IconHashtag,
   IconSparkles,
   IconSparkles,
   IconGlobeAlt,
   IconGlobeAlt,
@@ -102,10 +101,7 @@ function stripWorkingDirectory(filePath: string, workingDir?: string) {
 }
 }
 
 
 function getShikiLang(filename: string) {
 function getShikiLang(filename: string) {
-  const ext = filename
-    .split('.')
-    .pop()
-    ?.toLowerCase() ?? ''
+  const ext = filename.split(".").pop()?.toLowerCase() ?? ""
 
 
   // map.languages(ext) returns an array of matching Linguist language names (e.g. ['TypeScript'])
   // map.languages(ext) returns an array of matching Linguist language names (e.g. ['TypeScript'])
   const langs = map.languages(ext)
   const langs = map.languages(ext)
@@ -113,12 +109,10 @@ function getShikiLang(filename: string) {
 
 
   // Overrride any specific language mappings
   // Overrride any specific language mappings
   const overrides: Record<string, string> = {
   const overrides: Record<string, string> = {
-    "conf": "shellscript"
+    conf: "shellscript",
   }
   }
 
 
-  return type
-    ? overrides[type] ?? type
-    : 'plaintext'
+  return type ? (overrides[type] ?? type) : "plaintext"
 }
 }
 
 
 function formatDuration(ms: number): string {
 function formatDuration(ms: number): string {
@@ -1008,13 +1002,6 @@ export default function Share(props: {
                           }
                           }
                         >
                         >
                           {(assistant) => {
                           {(assistant) => {
-                            const system = createMemo(() => {
-                              const prompts = assistant().system || []
-                              return prompts.filter(
-                                (p: string) =>
-                                  !p.startsWith("You are Claude"),
-                              )
-                            })
                             return (
                             return (
                               <div
                               <div
                                 id={anchor()}
                                 id={anchor()}
@@ -1040,67 +1027,13 @@ export default function Share(props: {
                                     <span data-part-model>
                                     <span data-part-model>
                                       {assistant().modelID}
                                       {assistant().modelID}
                                     </span>
                                     </span>
-                                    <Show when={system().length > 0}>
-                                      <div data-part-tool-result>
-                                        <ResultsButton
-                                          showCopy="Show system prompt"
-                                          hideCopy="Hide system prompt"
-                                          results={showResults()}
-                                          onClick={() =>
-                                            setShowResults((e) => !e)
-                                          }
-                                        />
-                                        <Show when={showResults()}>
-                                          <TextPart
-                                            expand
-                                            data-size="sm"
-                                            data-color="dimmed"
-                                            text={system().join("\n\n").trim()}
-                                          />
-                                        </Show>
-                                      </div>
-                                    </Show>
                                   </div>
                                   </div>
                                 </div>
                                 </div>
                               </div>
                               </div>
                             )
                             )
                           }}
                           }}
                         </Match>
                         </Match>
-                        {/* System text */}
-                        <Match
-                          when={
-                            msg.role === "system" &&
-                            part.type === "text" &&
-                            part
-                          }
-                        >
-                          {(part) => (
-                            <div
-                              id={anchor()}
-                              data-section="part"
-                              data-part-type="system-text"
-                            >
-                              <div data-section="decoration">
-                                <AnchorIcon id={anchor()}>
-                                  <IconCpuChip width={18} height={18} />
-                                </AnchorIcon>
-                                <div></div>
-                              </div>
-                              <div data-section="content">
-                                <div data-part-tool-body>
-                                  <div data-part-title>
-                                    <span data-element-label>System</span>
-                                  </div>
-                                  <TextPart
-                                    data-size="sm"
-                                    text={part().text}
-                                    data-color="dimmed"
-                                  />
-                                </div>
-                              </div>
-                            </div>
-                          )}
-                        </Match>
+
                         {/* Grep tool */}
                         {/* Grep tool */}
                         <Match
                         <Match
                           when={
                           when={
@@ -1295,9 +1228,9 @@ export default function Share(props: {
                             const path = createMemo(() =>
                             const path = createMemo(() =>
                               toolData()?.args.path !== data().rootDir
                               toolData()?.args.path !== data().rootDir
                                 ? stripWorkingDirectory(
                                 ? stripWorkingDirectory(
-                                  toolData()?.args.path,
-                                  data().rootDir,
-                                )
+                                    toolData()?.args.path,
+                                    data().rootDir,
+                                  )
                                 : toolData()?.args.path,
                                 : toolData()?.args.path,
                             )
                             )
 
 
@@ -1658,8 +1591,7 @@ export default function Share(props: {
                           when={
                           when={
                             msg.role === "assistant" &&
                             msg.role === "assistant" &&
                             part.type === "tool-invocation" &&
                             part.type === "tool-invocation" &&
-                            part.toolInvocation.toolName ===
-                            "todowrite" &&
+                            part.toolInvocation.toolName === "todowrite" &&
                             part
                             part
                           }
                           }
                         >
                         >
@@ -1724,8 +1656,7 @@ export default function Share(props: {
                           when={
                           when={
                             msg.role === "assistant" &&
                             msg.role === "assistant" &&
                             part.type === "tool-invocation" &&
                             part.type === "tool-invocation" &&
-                            part.toolInvocation.toolName ===
-                            "webfetch" &&
+                            part.toolInvocation.toolName === "webfetch" &&
                             part
                             part
                           }
                           }
                         >
                         >
@@ -1899,9 +1830,7 @@ export default function Share(props: {
                                   >
                                   >
                                     <IconSparkles width={18} height={18} />
                                     <IconSparkles width={18} height={18} />
                                   </Match>
                                   </Match>
-                                  <Match when={msg.role === "system"}>
-                                    <IconCpuChip width={18} height={18} />
-                                  </Match>
+
                                   <Match when={msg.role === "user"}>
                                   <Match when={msg.role === "user"}>
                                     <IconUserCircle width={18} height={18} />
                                     <IconUserCircle width={18} height={18} />
                                   </Match>
                                   </Match>