Fixed reset of job desc. to remove agent
Fixed craco for streamingresponse
This commit is contained in:
parent
eb9382625a
commit
23a48738a3
@ -2,18 +2,37 @@ module.exports = {
|
||||
devServer: {
|
||||
server: {
|
||||
type: 'https',
|
||||
// You can also specify custom certificates if needed:
|
||||
// options: {
|
||||
// cert: '/path/to/cert.pem',
|
||||
// key: '/path/to/key.pem',
|
||||
// }
|
||||
},
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://backstory:8911', // Replace with your FastAPI server URL
|
||||
changeOrigin: true,
|
||||
secure: false, // Set to true if your FastAPI server uses HTTPS
|
||||
},
|
||||
setupMiddlewares: (middlewares, devServer) => {
|
||||
const { createProxyMiddleware } = require('http-proxy-middleware');
|
||||
|
||||
if (!devServer) {
|
||||
throw new Error('webpack-dev-server is not defined');
|
||||
}
|
||||
|
||||
devServer.app.use('/api', createProxyMiddleware({
|
||||
target: 'https://backstory:8911',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
buffer: false,
|
||||
proxyTimeout: 3600000,
|
||||
onProxyRes: function(proxyRes, req, res) {
|
||||
// Remove any header that might cause buffering
|
||||
proxyRes.headers['transfer-encoding'] = 'chunked';
|
||||
delete proxyRes.headers['content-length'];
|
||||
|
||||
// Set proper streaming headers
|
||||
proxyRes.headers['cache-control'] = 'no-cache';
|
||||
proxyRes.headers['content-type'] = 'text/event-stream';
|
||||
proxyRes.headers['connection'] = 'keep-alive';
|
||||
},
|
||||
}));
|
||||
|
||||
return middlewares;
|
||||
}
|
||||
},
|
||||
webpack: {
|
||||
|
@ -41,7 +41,7 @@
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "HTTPS=true WDS_SOCKET_HOST=backstory-beta.ketrenos.com WDS_SOCKET_PORT=443 craco start",
|
||||
"start": "WDS_SOCKET_HOST=backstory-beta.ketrenos.com WDS_SOCKET_PORT=443 craco start",
|
||||
"build": "craco build",
|
||||
"test": "craco test"
|
||||
},
|
||||
|
@ -1,5 +1,7 @@
|
||||
const getConnectionBase = (loc: any): string => {
|
||||
if (!loc.host.match(/.*battle-linux.*/)) {
|
||||
if (!loc.host.match(/.*battle-linux.*/)
|
||||
// && !loc.host.match(/.*backstory-beta.*/)
|
||||
) {
|
||||
return loc.protocol + "//" + loc.host;
|
||||
} else {
|
||||
return loc.protocol + "//battle-linux.ketrenos.com:8912";
|
||||
|
@ -249,7 +249,7 @@ const BackstoryApp = () => {
|
||||
}
|
||||
};
|
||||
fetchSession();
|
||||
}, []);
|
||||
}, [cookieSessionId, setSnack, storeInCookie, urlSessionId]);
|
||||
|
||||
const copyLink = () => {
|
||||
const link = `${window.location.origin}${window.location.pathname}?id=${sessionId}`;
|
||||
|
@ -152,15 +152,21 @@ const ResumeBuilderPage: React.FC<BackstoryPageProps> = (props: BackstoryPagePro
|
||||
|
||||
const jobResponse = useCallback(async (message: BackstoryMessage) => {
|
||||
if (message.actions && message.actions.includes("job_description")) {
|
||||
await jobConversationRef.current.fetchHistory();
|
||||
if (jobConversationRef.current) {
|
||||
await jobConversationRef.current.fetchHistory();
|
||||
}
|
||||
}
|
||||
if (message.actions && message.actions.includes("resume_generated")) {
|
||||
await resumeConversationRef.current.fetchHistory();
|
||||
if (resumeConversationRef.current) {
|
||||
await resumeConversationRef.current.fetchHistory();
|
||||
}
|
||||
setHasResume(true);
|
||||
setActiveTab(1); // Switch to Resume tab
|
||||
}
|
||||
if (message.actions && message.actions.includes("facts_checked")) {
|
||||
await factsConversationRef.current.fetchHistory();
|
||||
if (factsConversationRef.current) {
|
||||
await factsConversationRef.current.fetchHistory();
|
||||
}
|
||||
setHasFacts(true);
|
||||
}
|
||||
}, [setHasFacts, setHasResume, setActiveTab]);
|
||||
|
@ -261,9 +261,11 @@ class WebServer:
|
||||
)
|
||||
|
||||
if self.ssl_enabled:
|
||||
allow_origins = ["https://battle-linux.ketrenos.com:3000"]
|
||||
allow_origins = ["https://battle-linux.ketrenos.com:3000",
|
||||
"https://backstory-beta.ketrenos.com"]
|
||||
else:
|
||||
allow_origins = ["http://battle-linux.ketrenos.com:3000"]
|
||||
allow_origins = ["http://battle-linux.ketrenos.com:3000",
|
||||
"http://backstory-beta.ketrenos.com"]
|
||||
|
||||
logger.info(f"Allowed origins: {allow_origins}")
|
||||
|
||||
@ -470,6 +472,9 @@ class WebServer:
|
||||
)
|
||||
continue
|
||||
logger.info(f"Resetting {reset_operation} for {mode}")
|
||||
if mode != "chat":
|
||||
logger.info(f"Removing agent {tmp.agent_type} from {context_id}")
|
||||
context.remove_agent(tmp)
|
||||
tmp.conversation.reset()
|
||||
response["history"] = []
|
||||
response["context_used"] = agent.context_tokens
|
||||
|
@ -140,6 +140,10 @@ class Context(BaseModel):
|
||||
)
|
||||
self.agents.append(agent)
|
||||
|
||||
def remove_agent(self, agent: AnyAgent) -> None:
|
||||
"""Remove an Agent from the context based on its agent_type."""
|
||||
self.agents = [a for a in self.agents if a.agent_type != agent.agent_type]
|
||||
|
||||
def get_agent(self, agent_type: str) -> Agent | None:
|
||||
"""Return the Agent with the given agent_type, or None if not found."""
|
||||
for agent in self.agents:
|
||||
|
Loading…
x
Reference in New Issue
Block a user