|
1 | 1 |
|
2 | | -{} (:package |app) |
| 2 | +{} (:about "|file is generated - never edit directly; learn cr edit/tree workflows before changing") (:package |app) |
3 | 3 | :configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!) (:version |0.0.1) |
4 | 4 | :modules $ [] |respo.calcit/ |lilac/ |memof/ |respo-ui.calcit/ |reel.calcit/ |respo-markdown.calcit/ |alerts.calcit/ |
5 | 5 | :entries $ {} |
|
411 | 411 | if (:done? state) nil $ div ({}) (memof1-call-by :abort-streaming comp-abort "\"Streaming...") |
412 | 412 | if (:done? state) |
413 | 413 | div |
414 | | - {} $ :class-name (str-spaced css/row-middle) |
| 414 | + {} $ :class-name (str-spaced css/row-middle css/gap8) |
415 | 415 | comp-copy $ :answer state |
| 416 | + comp-fill $ either (:answer state) "\"" |
416 | 417 | =< nil 200 |
417 | 418 | comp-message-box (>> states :message-box) |
418 | 419 | a $ {} |
|
428 | 429 | if dev? $ comp-reel (>> states :reel) reel ({}) |
429 | 430 | if dev? $ comp-inspect "\"Store" store nil |
430 | 431 | :examples $ [] |
| 432 | + |comp-fill $ %{} :CodeEntry (:doc |) |
| 433 | + :code $ quote |
| 434 | + defcomp comp-fill (text) |
| 435 | + div $ {} (:class-name style-fill) (:inner-text "|➚") |
| 436 | + :on-click $ fn (e d!) |
| 437 | + when chrome-extension? $ js/chrome.runtime.sendMessage |
| 438 | + js-object (:action |fill-text) (:text text) |
| 439 | + :examples $ [] |
431 | 440 | |comp-message-box $ %{} :CodeEntry (:doc |) |
432 | 441 | :code $ quote |
433 | 442 | defcomp comp-message-box (states picker-el on-submit) |
434 | 443 | let |
435 | 444 | cursor $ :cursor states |
436 | 445 | state $ either (:data states) |
437 | 446 | {} (:content "\"") (:search? false) (:think? false) |
438 | | - [] (effect-focus) |
| 447 | + [] (effect-focus) (on-fill cursor state on-submit) |
439 | 448 | div |
440 | 449 | {} $ :class-name (str-spaced css/center style-message-box-panel) |
441 | 450 | div |
|
593 | 602 | :code $ quote |
594 | 603 | def models-menu $ [] (:: :item :gemini-flash "|Gemini Flash 3") (:: :item :gemini-pro "|Gemini Pro 3") (:: :item :gemini-flash-lite "|Gemini Flash Lite 2.5") (:: :item :flash-imagen "\"Flash Imagen") (:: :item :imagen-4 "\"Imagen 4") (:: :item :gemma "|Gemma 3 27b") (:: :item :openrouter/anthropic/claude-sonnet-4.5 "\"Openrouter Claude Sonnet 4.5") (:: :item :openrouter/anthropic/claude-opus-4 "\"Openrouter Claude Opus 4") (:: :item :openrouter/google/gemini-2.5-pro-preview "\"Openrouter Google Gemini 2.5 pro preview") (:: :item :openrouter/google/gemini-2.5-flash-preview-05-20 "\"Openrouter Google Gemini 2.5 flash preview") (:: :item :openrouter/openai/gpt-5 "\"Openrouter GPT 5") (:: :item :openrouter/deepseek/deepseek-chat-v3.1 "\"Openrouter deepseek-chat-v3.1") (; :: :item :claude-4.5 "\"Claude 4.5") |
595 | 604 | :examples $ [] |
| 605 | + |on-fill $ %{} :CodeEntry (:doc |) |
| 606 | + :code $ quote |
| 607 | + defn on-fill (cursor state on-submit) |
| 608 | + %{} respo.schema/RespoListener (:name :on-fill) |
| 609 | + :handler $ fn (event dispatch!) |
| 610 | + tag-match event $ |
| 611 | + :fill-text info |
| 612 | + let |
| 613 | + submit? $ either (:submit? info) true |
| 614 | + do |
| 615 | + dispatch! $ :: :states cursor |
| 616 | + assoc state :content $ :text info |
| 617 | + if submit? |
| 618 | + on-submit (:text info) (:search? state) (:think? state) dispatch! |
| 619 | + , nil |
| 620 | + :examples $ [] |
596 | 621 | |pattern-spaced-code $ %{} :CodeEntry (:doc |) |
597 | 622 | :code $ quote |
598 | 623 | def pattern-spaced-code $ noted "\"temp fix of nested code block" (&raw-code "\"/\\n\\s+```/g") |
|
639 | 664 | defstyle style-code-content $ {} |
640 | 665 | "\"&" $ {} (:line-height "\"1.5") (:font-size 13) |
641 | 666 | :examples $ [] |
| 667 | + |style-fill $ %{} :CodeEntry (:doc |) |
| 668 | + :code $ quote |
| 669 | + defstyle style-fill $ {} |
| 670 | + "\"&" $ {} (:position :relative) (:width 12) (:height 12) (:border-radius "\"2px") |
| 671 | + :border $ str "\"1.5px solid " (hsl 200 30 80) |
| 672 | + :cursor :pointer |
| 673 | + :user-select :none |
| 674 | + :display :inline-flex |
| 675 | + :align-items :center |
| 676 | + :justify-content :center |
| 677 | + :font-size 9 |
| 678 | + :line-height "\"12px" |
| 679 | + :color $ hsl 200 70 40 |
| 680 | + :examples $ [] |
642 | 681 | |style-gap12 $ %{} :CodeEntry (:doc |) |
643 | 682 | :code $ quote |
644 | 683 | defstyle style-gap12 $ {} |
|
805 | 844 | :code $ quote |
806 | 845 | defn listen-extension! () |
807 | 846 | js/chrome.runtime.onMessage.addListener $ fn (message sender respond!) |
808 | | - if |
809 | | - = "\"menu-trigger" $ .-action message |
| 847 | + when |
| 848 | + = "\"menu-summary" $ .-action message |
810 | 849 | let |
811 | 850 | content $ str "\"你扮演一个专业的工程师, 对以下内容做一下讲解, 用中文, 注意要简略, 内容注意分块.\n\n" &newline &newline (.-content message) |
812 | | - store $ :store @*reel |
813 | | - cursor $ [] |
814 | | - state0 $ get-in store ([] :states :data) |
815 | | - model $ either (:model store) :gemini |
816 | | - submit-message! cursor state0 content false false model dispatch! |
| 851 | + event-tuple $ :: :fill-text |
| 852 | + {} (:text content) (:submit? true) |
| 853 | + (send-to-component! event-tuple) |
| 854 | + when |
| 855 | + = "\"fill-text" $ .-action message |
| 856 | + let |
| 857 | + content $ .-text message |
| 858 | + submit? $ either (.-submit? message) true |
| 859 | + event-tuple $ :: :fill-text |
| 860 | + {} (:text content) (:submit? submit?) |
| 861 | + (send-to-component! event-tuple) |
| 862 | + when |
| 863 | + = "\"menu-translate" $ .-action message |
| 864 | + let |
| 865 | + content $ str "\"请将以下内容翻译成中文, 保持简洁分段:\n\n" &newline &newline (.-content message) |
| 866 | + event-tuple $ :: :fill-text |
| 867 | + {} (:text content) (:submit? true) |
| 868 | + (send-to-component! event-tuple) |
| 869 | + when |
| 870 | + = "\"menu-custom" $ .-action message |
| 871 | + let |
| 872 | + content $ .-content message |
| 873 | + event-tuple $ :: :fill-text |
| 874 | + {} (:text content) (:submit? false) |
| 875 | + (send-to-component! event-tuple) |
817 | 876 | js/chrome.runtime.connect $ js-object (:name |mySidepanel) |
818 | 877 | :examples $ [] |
819 | 878 | |main! $ %{} :CodeEntry (:doc |) |
|
877 | 936 | app.config :as config |
878 | 937 | "\"./calcit.build-errors" :default build-errors |
879 | 938 | "\"bottom-tip" :default hud! |
| 939 | + respo.controller.client :refer $ send-to-component! |
880 | 940 | :examples $ [] |
881 | 941 | |app.schema $ %{} :FileEntry |
882 | 942 | :defs $ {} |
|
0 commit comments