@yourgpt/copilot-sdk 1.2.9 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-MHLF2QXY.cjs → chunk-3427BQ4M.cjs} +32 -2
- package/dist/chunk-3427BQ4M.cjs.map +1 -0
- package/dist/{chunk-EYNSW3NR.js → chunk-N2SMQKRK.js} +32 -2
- package/dist/chunk-N2SMQKRK.js.map +1 -0
- package/dist/react/index.cjs +37 -37
- package/dist/react/index.d.cts +6 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +1 -1
- package/dist/ui/index.cjs +46 -21
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +43 -18
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-EYNSW3NR.js.map +0 -1
- package/dist/chunk-MHLF2QXY.cjs.map +0 -1
|
@@ -704,6 +704,14 @@ var AbstractChat = class {
|
|
|
704
704
|
this.dynamicContext = context;
|
|
705
705
|
this.debug("Context updated", { length: context.length });
|
|
706
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Set system prompt dynamically
|
|
709
|
+
* This allows updating the system prompt after initialization
|
|
710
|
+
*/
|
|
711
|
+
setSystemPrompt(prompt) {
|
|
712
|
+
this.config.systemPrompt = prompt;
|
|
713
|
+
this.debug("System prompt updated", { length: prompt.length });
|
|
714
|
+
}
|
|
707
715
|
/**
|
|
708
716
|
* Build the request payload
|
|
709
717
|
*/
|
|
@@ -1483,6 +1491,12 @@ var ChatWithTools = class {
|
|
|
1483
1491
|
setContext(context) {
|
|
1484
1492
|
this.chat.setContext(context);
|
|
1485
1493
|
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Set system prompt dynamically
|
|
1496
|
+
*/
|
|
1497
|
+
setSystemPrompt(prompt) {
|
|
1498
|
+
this.chat.setSystemPrompt(prompt);
|
|
1499
|
+
}
|
|
1486
1500
|
// ============================================
|
|
1487
1501
|
// Tool Registration
|
|
1488
1502
|
// ============================================
|
|
@@ -1836,6 +1850,12 @@ function CopilotProvider({
|
|
|
1836
1850
|
}
|
|
1837
1851
|
);
|
|
1838
1852
|
}
|
|
1853
|
+
react.useEffect(() => {
|
|
1854
|
+
if (chatRef.current && systemPrompt !== void 0) {
|
|
1855
|
+
chatRef.current.setSystemPrompt(systemPrompt);
|
|
1856
|
+
debugLog("System prompt updated from prop");
|
|
1857
|
+
}
|
|
1858
|
+
}, [systemPrompt, debugLog]);
|
|
1839
1859
|
const messages = react.useSyncExternalStore(
|
|
1840
1860
|
chatRef.current.subscribe,
|
|
1841
1861
|
() => chatRef.current.messages,
|
|
@@ -1915,6 +1935,13 @@ function CopilotProvider({
|
|
|
1915
1935
|
},
|
|
1916
1936
|
[debugLog]
|
|
1917
1937
|
);
|
|
1938
|
+
const setSystemPrompt = react.useCallback(
|
|
1939
|
+
(prompt) => {
|
|
1940
|
+
chatRef.current?.setSystemPrompt(prompt);
|
|
1941
|
+
debugLog("System prompt updated via function");
|
|
1942
|
+
},
|
|
1943
|
+
[debugLog]
|
|
1944
|
+
);
|
|
1918
1945
|
const sendMessage = react.useCallback(
|
|
1919
1946
|
async (content, attachments) => {
|
|
1920
1947
|
debugLog("Sending message:", content);
|
|
@@ -1989,6 +2016,8 @@ function CopilotProvider({
|
|
|
1989
2016
|
// AI Context
|
|
1990
2017
|
addContext,
|
|
1991
2018
|
removeContext,
|
|
2019
|
+
// System Prompt
|
|
2020
|
+
setSystemPrompt,
|
|
1992
2021
|
// Config
|
|
1993
2022
|
threadId,
|
|
1994
2023
|
runtimeUrl,
|
|
@@ -2016,6 +2045,7 @@ function CopilotProvider({
|
|
|
2016
2045
|
registeredActions,
|
|
2017
2046
|
addContext,
|
|
2018
2047
|
removeContext,
|
|
2048
|
+
setSystemPrompt,
|
|
2019
2049
|
threadId,
|
|
2020
2050
|
runtimeUrl,
|
|
2021
2051
|
toolsConfig
|
|
@@ -3768,5 +3798,5 @@ exports.useToolExecutor = useToolExecutor;
|
|
|
3768
3798
|
exports.useToolWithSchema = useToolWithSchema;
|
|
3769
3799
|
exports.useTools = useTools;
|
|
3770
3800
|
exports.useToolsWithSchema = useToolsWithSchema;
|
|
3771
|
-
//# sourceMappingURL=chunk-
|
|
3772
|
-
//# sourceMappingURL=chunk-
|
|
3801
|
+
//# sourceMappingURL=chunk-3427BQ4M.cjs.map
|
|
3802
|
+
//# sourceMappingURL=chunk-3427BQ4M.cjs.map
|